Authored by xuqi

补全scroll时class控制

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