...
|
...
|
@@ -85,36 +85,34 @@ exports.init = function() { |
|
|
containerH = container.height(); //article-type-three高度
|
|
|
containerTop = container.offset().top; //article-type-three offset top
|
|
|
|
|
|
function resetStatus() {
|
|
|
thumbContainer.removeClass('static fixed-top fixed-bottom absolute').css('top', '');
|
|
|
prodList.css('margin-top', '');
|
|
|
}
|
|
|
|
|
|
//scroll时控制列表的位置
|
|
|
$(document).scroll(function() {
|
|
|
var sTop = $(this).scrollTop();
|
|
|
|
|
|
resetStatus();
|
|
|
//Tip: removeClass只用移除相邻状态即可
|
|
|
if (sTop <= containerTop - wH + tContainerH) {
|
|
|
thumbContainer
|
|
|
.addClass('fixed-bottom')
|
|
|
.removeClass('static');
|
|
|
.addClass('fixed-bottom');
|
|
|
prodList.css({
|
|
|
'margin-top': tContainerH
|
|
|
});
|
|
|
} else if (sTop <= containerTop) {
|
|
|
thumbContainer
|
|
|
.addClass('static')
|
|
|
.removeClass('fixed-bottom fixed-top')
|
|
|
.css('top' , '');
|
|
|
prodList.removeAttr('style')
|
|
|
.addClass('static');
|
|
|
} else if (sTop <= containerTop + containerH - tContainerH) {
|
|
|
thumbContainer
|
|
|
.addClass('fixed-top')
|
|
|
.removeClass('static absolute')
|
|
|
.css('top' , '');
|
|
|
.addClass('fixed-top');
|
|
|
prodList.css({
|
|
|
'margin-top': tContainerH
|
|
|
});
|
|
|
} else if (sTop <= containerTop + containerH) {
|
|
|
thumbContainer
|
|
|
.addClass('absolute')
|
|
|
.removeClass('static fixed-top')
|
|
|
.css({
|
|
|
top: containerTop + containerH - tContainerH
|
|
|
});
|
...
|
...
|
@@ -123,10 +121,7 @@ exports.init = function() { |
|
|
});
|
|
|
} else if (sTop > containerTop + containerH) {
|
|
|
thumbContainer
|
|
|
.addClass('static')
|
|
|
.removeClass('absolute')
|
|
|
.css('top' , '');
|
|
|
prodList.removeAttr('style');
|
|
|
.addClass('static');
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
|