问题
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