Kaynağa Gözat

修改走进中泽企业文化

zjm
等你 4 ay önce
ebeveyn
işleme
a0b1889c61

+ 32
- 5
src/pages/common/js/Common.js Dosyayı Görüntüle

@@ -6,6 +6,7 @@
6 6
 import { isMobile } from "./utils";
7 7
 import gsap from 'gsap'
8 8
 import LocomotiveScroll from 'locomotive-scroll';
9
+import $ from '/dev/static/lib/jquery-2.1.1.min.js';
9 10
 export default class Common {
10 11
   /* 
11 12
     mainDom - 菜单展开时,需要往下移动的dom节点
@@ -22,10 +23,10 @@ export default class Common {
22 23
     } else {
23 24
       this.headerMenu();
24 25
     }
25
-    new WOW().init();
26
+    
26 27
     
27 28
     // let goTop = document.querySelector(".goTopBtn");
28
-    // const scroll = new LocomotiveScroll();
29
+    const scroll = new LocomotiveScroll();
29 30
     // goTop.addEventListener("click", (e) => {
30 31
     //   console.log('click');
31 32
       
@@ -52,10 +53,36 @@ export default class Common {
52 53
     let url = new URL(window.location.href);
53 54
     let anchor = url.hash.substring(1);
54 55
     
55
-    let element = document.getElementById(anchor);
56
-    if (element) {
57
-      element.scrollIntoView({ behavior: 'smooth' });
56
+    console.log(anchor,88);
57
+    
58
+    if (anchor) {
59
+      let element = document.getElementById(anchor);
60
+      element.scrollIntoView({ behavior: 'smooth',block: 'start' });
58 61
     }
62
+    if(window.location.href.indexOf("intoZz.html?") !== -1){
63
+      
64
+    }else{
65
+      new WOW().init();
66
+    }
67
+    $('a').on("click",function(event) {
68
+      
69
+      let str=$(this).attr("href");
70
+      
71
+      if(str.indexOf("intoZz.html#") !== -1){
72
+        event.preventDefault();
73
+        let hashIndex = str.indexOf('#');
74
+        let beforeHash = str.substring(0, hashIndex); // 获取 # 前面的部分
75
+        let afterHash = str.substring(hashIndex + 1);
76
+        let newStr = beforeHash + '?jumpz=' + afterHash;
77
+        window.location.href = ''+newStr;
78
+      }
79
+      
80
+      // let element = document.getElementById(targetId);
81
+      // if (element) {
82
+      //     element.scrollIntoView({ behavior: 'smooth', block: 'start' });
83
+      // }
84
+    });
85
+    
59 86
     // 微信二维码
60 87
     let wx=document.querySelector(".footerIcon .weixin");
61 88
     wx.addEventListener("click", (e) => {

+ 47
- 17
src/pages/intoZz/App.js Dosyayı Görüntüle

@@ -34,7 +34,11 @@ export default class App {
34 34
                 // item.load();
35 35
             }
36 36
         });
37
-        this.four();
37
+        let _this=this;
38
+        $(document).ready(function() {
39
+            _this.four();
40
+        });
41
+        
38 42
     }
39 43
     four() {
40 44
         let isMob = this.isMobile;
@@ -67,32 +71,38 @@ export default class App {
67 71
                         if (index > 0) {
68 72
                             fourRsons[index - 1].style.clipPath = 'inset(0px 0px 100%)';
69 73
                         }
74
+                        fourRsons[index + 1].style.clipPath = 'inset(0px 0px 0%)';
70 75
                     }
71 76
                     if (index < fourSons.length) fourSons[index + 1].style.opacity = 0.3 + (val > 0.7 ? 0.7 : val);
72 77
                 }
73 78
             })
74 79
         }
75 80
 
76
-
81
+        //锚点跳转
82
+        let jumpM='';
83
+        if(window.location.href.indexOf("intoZz.html?") !== -1){
84
+            let ss=window.location.href.indexOf('=');
85
+            let afterHash = window.location.href.substring(ss + 1);
86
+            console.log(afterHash,88);
87
+            jumpM="#"+afterHash;
88
+            $(window).scrollTop(10);
89
+            // $("#"+afterHash).offset().top
90
+        }
77 91
         // 获取元素的滚动条高度
78 92
         let scrollHeight = fourCon.scrollHeight;
79 93
         let conStart = 0;
80 94
         let conEnd = 0;
81 95
         function updateScrollChange1() {
96
+            
82 97
             try {
83
-                let hh = fourCon.getBoundingClientRect();
84
-                let scrollTop = hh.top;
85
-                let scrollBottom = hh.bottom;
86 98
                 let scrollY = window.scrollY;
87
-
88
-
89
-                if (scrollTop < 0 & conStart == 0) {
90
-                    conStart = scrollY;
91
-                    conEnd = scrollY + scrollHeight;
99
+                if(conStart==0){
100
+                    conStart = $(".fourCon").offset().top;
101
+                    conEnd = conStart+$(".fourCon").height();
92 102
                     let startH = 0;
93 103
                     sonArr.forEach((item, index) => {
94
-                        let childH = scrollY + startH + item[0];
95
-                        let childHs = scrollY + startH;
104
+                        let childH = conStart + startH + item[0];
105
+                        let childHs = conStart + startH;
96 106
                         if(index==0){
97 107
                             startH += item[0]-80;
98 108
                         }else{
@@ -101,10 +111,18 @@ export default class App {
101 111
                         item.push(childH)
102 112
                         item.push(childHs)
103 113
                     });
104
-                } else if (scrollTop < 0 && scrollY > conStart && scrollY < conEnd) {
105
-
106
-
107
-
114
+                    if(jumpM!=''){
115
+                        let jj=$(jumpM).offset().top;
116
+                        $('html, body').animate({
117
+                            scrollTop: jj
118
+                        }, 'slow',function(){
119
+                            // new WOW().init();
120
+                        });
121
+                    }
122
+                    console.log(scrollY, 'scrollY',conStart,conEnd)
123
+                    
124
+                }
125
+                if (scrollY > conStart && scrollY < conEnd) {
108 126
                     sonArr.forEach((item, index) => {
109 127
                         let chazhi = item[2] - scrollY;
110 128
                         if (chazhi > 0 && scrollY < item[2] && scrollY > item[3]) {
@@ -118,13 +136,25 @@ export default class App {
118 136
                         }
119 137
                     });
120 138
                 }
121
-            } catch (error) { }
139
+            } catch (error) {
140
+                console.log(error);
141
+                
142
+             }
122 143
         }
123 144
 
124 145
 
125 146
         // 添加滚动事件监听器
126 147
         if(!isMob){
127 148
             window.addEventListener('scroll', updateScrollChange1);
149
+        }else{
150
+            
151
+            if(jumpM!=''){
152
+                new WOW().init();
153
+                let jj=$(jumpM).offset().top;
154
+                $('html, body').animate({
155
+                    scrollTop: jj
156
+                }, 'slow');
157
+            }
128 158
         }
129 159
         
130 160
         //弹框资质荣誉

+ 2
- 2
src/pages/intoZz/index.html Dosyayı Görüntüle

@@ -19,8 +19,8 @@
19 19
     <%= require('../common/tpl/header.tpl') %>
20 20
     
21 21
     <div class="main">
22
-      <div class="intoCon">
23
-        <div class="intoTop" id="jtjj">
22
+      <div class="intoCon" id="jtjj">
23
+        <div class="intoTop">
24 24
           <div class="wow fadeInUp title">集团简介</div>
25 25
           <div class="wow fadeInUp">
26 26
             <div class="text">中泽控股集团股份有限公司(简称中泽集团)是以投资并购和企业运营为核心业务的大型民营集团,创建于1995年,总部位于北京。</div>

Loading…
İptal
Kaydet