我正在尝试对窗口滚动事件执行一些操作,但它不工作。
我的代码
$(window).scroll(function () {
// var limit = 7; //The number of records to display per request
var lastID = $newsfeed_start;
if (($(window).scrollTop() == $(document).height() - $(window).height()&& (lastID != 0)) {
// increment strat value
$newsfeed_start = $newsfeed_start + $newsfeed_limit;
get_timeline_post('');
}
});
即使美元(窗口)。Scroll (function(){})函数不工作
你的CSS实际上是在设置文档的其余部分不显示溢出,因此文档本身不会滚动。最简单的解决方法是将事件绑定到正在滚动的东西上,在您的例子中是div#page。
所以它很容易改变:
$(document).scroll(function() { // OR $(window).scroll(function() {
didScroll = true;
});
$('div#page').scroll(function() {
didScroll = true;
});