Authored by 郭成尧

Scroll

... ... @@ -67,12 +67,14 @@ class ProductListWithFilter {
/**
* 滚动加载
*/
$(window).scroll(function() {
setTimeout(function() {
$(window).scroll(() => {
setTimeout(() => {
let afterScroll = document.body.scrollTop;
if (afterScroll - this.beforeScroll > 0) {
window.requestAnimationFrame(this.scrollHandler());
window.requestAnimationFrame(() => {
this.scrollHandler();
});
this.beforeScroll = afterScroll;
} else {
return false;
... ... @@ -341,8 +343,9 @@ class ProductListWithFilter {
* 当scroll到1/2$goodsContainer高度后继续请求下一页数据
*/
scrollHandler() {
if (this.view.allGoodsTabPage.hasClass('active') &&
$(window).scrollTop() > this.view.goodsContainer.height() * 0.6) {
let goodsContainerHeight = this.view.goodsContainer.height();
if ($(window).scrollTop() > goodsContainerHeight * 0.6) {
this.isScrollLoad = true;
this.getGoodsList();
}
... ...