[英]Execute function on bottom of the page using javascript or jquery
如果用戶使用JavaScript或jquery在底部滾動,我想執行功能"nextResults()"
。 我的代碼不起作用。
我的代碼:
$(window).scroll(function() {
if($(window).scrollTop() = $(document).height() - $(window).height()) {
nextResults();
}
});
改成:
$(window).scrollTop() === $(document).height() - $(window).height()
$(window).scroll(function() {
if($(window).scrollTop() == $(document).height() - $(window).height()) {
nextResults();
}
});
條件表達式錯誤,應為“ ==”,但您的條件表達式為“ =”
您可以在此處進行測試,請檢查瀏覽器開發人員工具控制台: JSFiddle
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.