Showing
1 changed file
with
5 additions
and
6 deletions
@@ -61,31 +61,30 @@ exports.init = function() { | @@ -61,31 +61,30 @@ exports.init = function() { | ||
61 | $(document).scroll(function() { | 61 | $(document).scroll(function() { |
62 | var sTop = $(this).scrollTop(); | 62 | var sTop = $(this).scrollTop(); |
63 | 63 | ||
64 | - //Tip: removeClass只用移除相邻状态即可 | ||
65 | if (sTop <= containerTop - wH + tContainerH) { | 64 | if (sTop <= containerTop - wH + tContainerH) { |
66 | thumbContainer | 65 | thumbContainer |
67 | .addClass('fixed-bottom') | 66 | .addClass('fixed-bottom') |
68 | - .removeClass('static'); | 67 | + .removeClass('static fixed-top absolute'); |
69 | } else if (sTop <= containerTop) { | 68 | } else if (sTop <= containerTop) { |
70 | thumbContainer | 69 | thumbContainer |
71 | .addClass('static') | 70 | .addClass('static') |
72 | - .removeClass('fixed-bottom fixed-top'); | 71 | + .removeClass('fixed-bottom fixed-top absolute'); |
73 | } else if (sTop <= containerTop + containerH - tContainerH) { | 72 | } else if (sTop <= containerTop + containerH - tContainerH) { |
74 | thumbContainer | 73 | thumbContainer |
75 | .addClass('fixed-top') | 74 | .addClass('fixed-top') |
76 | - .removeClass('static absolute') | 75 | + .removeClass('static absolute fixed-bottom') |
77 | .removeAttr('style'); | 76 | .removeAttr('style'); |
78 | } else if (sTop < containerTop + containerH) { | 77 | } else if (sTop < containerTop + containerH) { |
79 | thumbContainer | 78 | thumbContainer |
80 | .addClass('absolute') | 79 | .addClass('absolute') |
81 | - .removeClass('static fixed-top') | 80 | + .removeClass('static fixed-top fixed-bottom') |
82 | .css({ | 81 | .css({ |
83 | top: containerTop + containerH - tContainerH | 82 | top: containerTop + containerH - tContainerH |
84 | }); | 83 | }); |
85 | } else if (sTop > containerTop + containerH) { | 84 | } else if (sTop > containerTop + containerH) { |
86 | thumbContainer | 85 | thumbContainer |
87 | .addClass('static') | 86 | .addClass('static') |
88 | - .removeClass('absolute') | 87 | + .removeClass('absolute fixed-top fixed-bottom') |
89 | .removeAttr('style'); | 88 | .removeAttr('style'); |
90 | } | 89 | } |
91 | }); | 90 | }); |
-
Please register or login to post a comment