Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery scrollTop()不';我不在野生动物园工作_Javascript_Jquery_Ajax - Fatal编程技术网

Javascript jQuery scrollTop()不';我不在野生动物园工作

Javascript jQuery scrollTop()不';我不在野生动物园工作,javascript,jquery,ajax,Javascript,Jquery,Ajax,我使用这个函数来分块加载网页,以减少主页的页面加载时间 这在chrome和UC浏览器中运行良好。只有safari浏览器出现了问题 这是我的代码: if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page? { } 当我要提醒循环中的某些东西时,它在iphone中也不起作用。 指引我哪里做错了什么 谢谢。我记得,safa

我使用这个函数来分块加载网页,以减少主页的页面加载时间

这在chrome和UC浏览器中运行良好。只有safari浏览器出现了问题

这是我的代码:

if($(window).scrollTop() + $(window).height() == $(document).height())  //user scrolled to bottom of the page?
        {
}
当我要提醒循环中的某些东西时,它在iphone中也不起作用。 指引我哪里做错了什么


谢谢。

我记得,safari的jquerys窗口高度有问题。 请尝试
window.innerHeight

所以你的代码看起来像这样

if($(window).scrollTop() + window.innerHeight == $(document).height()) {
    alert('bottom')
}

Mephiztopheles:很好..我还可以检查一下卷轴是否在底部上方很小。这样加载程序将在滚动触底之前调用。这类似于
$(窗口).scrollTop()+窗口.innerHeight>=$(文档).height()-BUFFER
。。。我希望如此:D没有检查它,但它应该是这样编辑的:您需要
=
,因为您无法准确地滚动该值。。。因此,在滚动时将触发函数。。每个滚动事件。。。还记得你是怎么用的吗?你有小提琴给我吗?然后我可以检查一下,也许可以帮你:)