【发布时间】:2016-06-01 00:07:27
【问题描述】:
我正在尝试在我的网站上实现无限滚动,它适用于任何计算机上的浏览器,但它在移动浏览器上存在问题。到目前为止,在 chrome 上,如果我不放大或缩小它可以正常工作,但是一旦我放大任何一种方式,它就会停止工作。在 safari 上它根本不起作用。这是我正在使用的代码:
$(window).on('scroll', function (e) {
console.log(" window.scrollTop = " + $(window).scrollTop() + " document.height=" + $(document).height() + " window.height =" + $(window).height());
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
load();
}
});
如果有人有任何建议,请告诉我。
【问题讨论】:
-
试试
touchmove而不是scroll。 -
touchmove 是否也适用于笔记本电脑浏览器?如何在普通浏览器上保持相同的功能并使其在移动浏览器上也能正常工作?
标签: javascript mobile infinite-scroll