使用Ajax进行无限滚动不适用于Chrome [英] Infinite scrolling with ajax does not work with Chrome

查看:45
本文介绍了使用Ajax进行无限滚动不适用于Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,因此,在这个站点上进行了大量研究之后,我编写了执行无限滚动的代码.

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!');
    }
});

事实是,当在Mozilla中运行时,这完全可以正常工作.但是,当我在Chrome或Opera中尝试相同的操作时,它没有效果.

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?

推荐答案

尝试使用> =代替==,如果没有帮助,请尝试在console.log中显示每个变量并对此进行分析

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

这篇关于使用Ajax进行无限滚动不适用于Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆