Created
July 27, 2017 08:43
-
-
Save huoxudong125/547fe11b081070669033029bc413601c to your computer and use it in GitHub Desktop.
上拉加载更多产品,引入Throttle避免部分浏览器触发多次 滚动事件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//滚动事件 | |
$(".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