fix the issue of scroll bar show when there is no scroll. code review by XWG
Showing
1 changed file
with
14 additions
and
0 deletions
@@ -22,6 +22,9 @@ require('./good'); | @@ -22,6 +22,9 @@ require('./good'); | ||
22 | 22 | ||
23 | lazyLoad($('img.lazy')); | 23 | lazyLoad($('img.lazy')); |
24 | 24 | ||
25 | +console.log($(document).height()); | ||
26 | +console.log($(window).height()); | ||
27 | + | ||
25 | if ('advance' === cartType) { | 28 | if ('advance' === cartType) { |
26 | $cartContent.toggleClass('hide'); | 29 | $cartContent.toggleClass('hide'); |
27 | } | 30 | } |
@@ -82,5 +85,16 @@ if ($('.cart-zero').length > 0) { | @@ -82,5 +85,16 @@ if ($('.cart-zero').length > 0) { | ||
82 | require('../product/recommend-for-you'); | 85 | require('../product/recommend-for-you'); |
83 | } | 86 | } |
84 | 87 | ||
88 | +function notAllowScroll() { | ||
89 | + var docH = $(document).height(), | ||
90 | + winH = $(window).height(); | ||
91 | + | ||
92 | + if (docH - winH <= 10) { | ||
93 | + $('body').css('overflow', 'hidden'); | ||
94 | + } | ||
95 | +} | ||
96 | + | ||
97 | +notAllowScroll(); | ||
98 | + | ||
85 | //提前触发lazyload | 99 | //提前触发lazyload |
86 | $(window).scrollTop(1).scrollTop(0); | 100 | $(window).scrollTop(1).scrollTop(0); |
-
Please register or login to post a comment