我正在尝试获取警报以显示用户是否在页面底部的 100 像素内滚动。我让 /friends 加载到 div class = social,但我在滚动部分遇到问题。关于我可以解决的问题有什么建议吗?
<!--Load friends module -->
<script>
$(document).ready(function (){
$('.social').load("/friends");
});
</script>
<!--Load more videos if scroll within 100 pixels of bottom -->
<script type="text/javascript">
counter = 2;
$(document).ready(function (){
function loadMore() {
console.log("More loaded");
alert("test");
$('.more_videos').load("/more_videos/"+counter);
$(window).bind('scroll', bindScroll);
}
function bindScroll(){
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
$(window).unbind('scroll');
loadMore();
}
}
$(window).scroll(bindScroll);
});
counter = counter+1;
</script>