Authored by 郭成尧

'滚动条改回去'

@@ -13,19 +13,11 @@ @@ -13,19 +13,11 @@
13 -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 13 -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
14 } 14 }
15 15
16 -html {  
17 - height: 100%;  
18 - width: 100%;  
19 - overflow: hidden;  
20 -  
21 - body {  
22 - width: 100%;  
23 - height: 100%;  
24 - overflow-y: scroll; 16 +html,
  17 +body {
25 font-size: 24px; 18 font-size: 24px;
26 font-family: "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial; 19 font-family: "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
27 line-height: 1.4; 20 line-height: 1.4;
28 - }  
29 } 21 }
30 22
31 /* stylelint-disable */ 23 /* stylelint-disable */
@@ -140,16 +140,14 @@ @@ -140,16 +140,14 @@
140 let ghost2 = false; 140 let ghost2 = false;
141 let ghost3 = false; 141 let ghost3 = false;
142 142
143 - let myHeaderTop = $('.my-header').offset().top;  
144 -  
145 - if (myHeaderTop < -40) { 143 + if (window.scrollY > 40) {
146 ghost = false; 144 ghost = false;
147 ghost2 = false; 145 ghost2 = false;
148 ghost3 = false; 146 ghost3 = false;
149 - } else if (myHeaderTop < -25) { 147 + } else if (window.scrollY > 25) {
150 ghost = false; 148 ghost = false;
151 ghost3 = true; 149 ghost3 = true;
152 - } else if (myHeaderTop < -10) { 150 + } else if (window.scrollY > 10) {
153 ghost = false; 151 ghost = false;
154 ghost2 = true; 152 ghost2 = true;
155 } 153 }
@@ -167,17 +165,15 @@ @@ -167,17 +165,15 @@
167 return false; 165 return false;
168 }); 166 });
169 167
170 - let body = $('body');  
171 -  
172 - body.on('touchmove', () => { 168 + window.addEventListener('touchmove', () => {
173 this.toggle(); 169 this.toggle();
174 }); 170 });
175 171
176 - body.on('scroll', () => { 172 + window.addEventListener('scroll', () => {
177 this.toggle(); 173 this.toggle();
178 }); 174 });
179 175
180 - body.on('visibilitychange', () => { 176 + document.addEventListener('visibilitychange', () => {
181 if (!document.hidden) { 177 if (!document.hidden) {
182 this.reload(); 178 this.reload();
183 } 179 }
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 <script> 19 <script>
20 const yoho = require('yoho'); 20 const yoho = require('yoho');
21 const cheader = require('component/header.vue'); 21 const cheader = require('component/header.vue');
22 - const $ = require('jquery');  
23 22
24 module.exports = { 23 module.exports = {
25 data() { 24 data() {
@@ -46,15 +45,15 @@ @@ -46,15 +45,15 @@
46 }, 45 },
47 46
48 created() { 47 created() {
49 - $('body').on('scroll', () => { 48 + window.onscroll = () => {
50 let transparent = true; 49 let transparent = true;
51 50
52 - if ($('.image-carousel').offset().top < -20) { 51 + if (window.scrollY > 20) {
53 transparent = false; 52 transparent = false;
54 } 53 }
55 54
56 this.$refs.header.$el.classList.toggle('ghost', transparent); 55 this.$refs.header.$el.classList.toggle('ghost', transparent);
57 - }); 56 + };
58 } 57 }
59 }; 58 };
60 </script> 59 </script>
@@ -86,9 +86,9 @@ @@ -86,9 +86,9 @@
86 }, 86 },
87 changeTopStatus() { 87 changeTopStatus() {
88 let topChange = true; 88 let topChange = true;
89 - let topHeight = $('.brand-top-box').offset().top; 89 + let topHeight = document.body.scrollTop;
90 90
91 - if (topHeight < -200) { 91 + if (topHeight > 100) {
92 topChange = false; 92 topChange = false;
93 } 93 }
94 94
@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 this.domain = this.shareData.domain; 99 this.domain = this.shareData.domain;
100 100
101 if (this.shareData.isBlkShop) { 101 if (this.shareData.isBlkShop) {
102 - $('body').on('scroll', this.changeTopStatus); 102 + window.onscroll = this.changeTopStatus;
103 } 103 }
104 } 104 }
105 }; 105 };