Skip to content

Instantly share code, notes, and snippets.

@huoxudong125
Created July 27, 2017 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huoxudong125/547fe11b081070669033029bc413601c to your computer and use it in GitHub Desktop.
Save huoxudong125/547fe11b081070669033029bc413601c to your computer and use it in GitHub Desktop.
上拉加载更多产品,引入Throttle避免部分浏览器触发多次 滚动事件
//滚动事件
$(".contain").scroll(function () {
if ($(this).scrollTop() + $(this).innerHeight() > $(this)[0].scrollHeight - 300) {
if (new Date().getTime() - mySpace.now > 2000) {
mySpace.now = new Date().getTime();
setTimeout(function () {
console.log(mySpace.currentTabId + " scroll to bottom");
mySpace.getDataByTabId();
// alert("scroll to bottom"+ mySpace.now);
},100);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment