如果用户使用javascript或jquery在底部滚动,我想执行函数"nextResults()"
。
我的代码不起作用。
我的代码:
$(window).scroll(function() {
if($(window).scrollTop() = $(document).height() - $(window).height()) {
nextResults();
}
});
答案 0 :(得分:0)
更改为:
$(window).scrollTop() === $(document).height() - $(window).height()
答案 1 :(得分:0)
$(window).scroll(function() {
if($(window).scrollTop() == $(document).height() - $(window).height()) {
nextResults();
}
});
错误的条件表达式,它应该是'==',但你的是'='
您可以在此处测试,请查看浏览器开发人员工具控制台:JSFiddle