Authored by 郭成尧

$scroll-to-js-onscroll

... ... @@ -69,26 +69,28 @@ class ProductListWithFilter {
});
this.view.listNav.on('touchend touchcancel', this.listNavTouch.bind(this));
let self = this;
/**
* 滚动加载
*/
$(window).scroll(() => {
if (this.scrollActived) {
setTimeout(() => {
let afterScroll = document.body.scrollTop;
window.onscroll = function() {
if (self.scrollActived) {
setTimeout(function() {
let afterScroll = window.scrollY;
if (afterScroll - this.beforeScroll > 0) {
if (afterScroll - self.beforeScroll > 0) {
window.requestAnimationFrame(() => {
this.scrollHandler();
self.scrollHandler();
});
this.beforeScroll = afterScroll;
self.beforeScroll = afterScroll;
} else {
this.beforeScroll = afterScroll;
self.beforeScroll = afterScroll;
return false;
}
}, 5);
}
});
};
}
/**
... ...