【发布时间】:2014-08-18 09:58:59
【问题描述】:
我已经使用overflow-x:scroll 设置了一个div (#reviewspostscont),现在我想使用AJAX 加载帖子,但我无法检测到滚动条何时到达最右端。 下面是我到目前为止的代码,我不明白它有什么问题。 提前致谢, 马特
$('#reviewspostscont').scroll(function(){
var $this = $(this);
scrollPercentage = 100 * $(this).scrollLeft() / ($('#reviewspostscont').width() - $(this).width());
if (scrollPercentage == 100){
alert('end!'); // just to test the code, then AJAX
}
});
【问题讨论】:
标签: javascript jquery ajax scroll infinite-scroll