Infinite scrolling with ajax does not work with Chrome

怎甘沉沦 提交于 2021-02-09 10:56:07

问题


Okay, so after doing a lot of research on this very site, I have written the code to perform infinite scrolling.

JS:

$(window).scroll(function() {
    if ($(window).scrollTop() + $(window).height() == $(document).height()) {
        alert('This is Bottom!');
    }
});

Thing is, this works perfectly fine when run in Mozilla. But when I tried the same in Chrome or Opera, it didn't work.

Could you guys please help me out and tell me where the problem lies?


回答1:


Try to use >= instead ==, if don't helps you, try to display each of variables in console.log and analyze this



来源:https://stackoverflow.com/questions/45121034/infinite-scrolling-with-ajax-does-not-work-with-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!