...
|
...
|
@@ -61,30 +61,31 @@ exports.init = function() { |
|
|
$(document).scroll(function() {
|
|
|
var sTop = $(this).scrollTop();
|
|
|
|
|
|
//Tip: removeClass只用移除相邻状态即可
|
|
|
if (sTop <= containerTop - wH + tContainerH) {
|
|
|
thumbContainer
|
|
|
.addClass('fixed-bottom')
|
|
|
.removeClass('static fixed-top absolute');
|
|
|
.removeClass('static');
|
|
|
} else if (sTop <= containerTop) {
|
|
|
thumbContainer
|
|
|
.addClass('static')
|
|
|
.removeClass('fixed-bottom fixed-top absolute');
|
|
|
.removeClass('fixed-bottom fixed-top');
|
|
|
} else if (sTop <= containerTop + containerH - tContainerH) {
|
|
|
thumbContainer
|
|
|
.addClass('fixed-top')
|
|
|
.removeClass('static absolute fixed-bottom')
|
|
|
.removeClass('static absolute')
|
|
|
.removeAttr('style');
|
|
|
} else if (sTop < containerTop + containerH) {
|
|
|
thumbContainer
|
|
|
.addClass('absolute')
|
|
|
.removeClass('static fixed-top fixed-bottom')
|
|
|
.removeClass('static fixed-top')
|
|
|
.css({
|
|
|
top: containerTop + containerH - tContainerH
|
|
|
});
|
|
|
} else if (sTop > containerTop + containerH) {
|
|
|
thumbContainer
|
|
|
.addClass('static')
|
|
|
.removeClass('absolute fixed-top fixed-bottom')
|
|
|
.removeClass('absolute')
|
|
|
.removeAttr('style');
|
|
|
}
|
|
|
});
|
...
|
...
|
|