scrollTop()函数在Android浏览器中不起作用 [英] scrollTop() function not working in Android browsers

查看:793
本文介绍了scrollTop()函数在Android浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用ASP.NET MVC编写Web应用程序.我正在尝试实现几个列表,这些列表必须在常规的网络浏览器以及移动设备(智能手机和平板电脑上的浏览器)上都能很好地显示.我要创建的功能之一是在这些列表上进行无限滚动. javascript(使用jQuery 1.6.4的javascript)在除Android平台上的浏览器以外的任何浏览器中均可正常运行.

问题在于,scrollTop函数始终返回0,而所有其他平台上的浏览器均返回滚动条当前位置的值.

Hey guys,

I''m writing a web app using ASP.NET MVC. I''m trying to implement a couple of lists which must display well on regular webbrowsers, and also on mobile devices (browsers on smartphones and tablets). One of the features i''m trying to create is infinite scroll on those lists. The javascript (i''m using jQuery 1.6.4) works fine in any browser except for browsers on the Android platform.

The problem is that the scrollTop function always returns 0, while the browsers on all other plaforms return the value of the scrollbar''s current position.

<div class="scroll">allow scrolling for this div</div>


每个附加了类滚动的div均具有overflow: scrollbar样式和固定大小.当滚动条到达底部时,它将触发一个新功能,该功能允许页面加载一组新数据,这些数据将被添加到现有数据列表中.但是由于android设备上的scrollTop()始终返回0,所以我无法检测到滚动条触底,因此应该加载新的数据部分.


Each div with the class scroll attached to it, has an overflow: scrollbar style and a fixed size. When the scrollbar hits the bottom, it should trigger a new function allowing the page to load a new set of data, which will be added to the existing list of data. But since the scrollTop() on android devices always return 0 I cannot detect that the scrollbar hits the bottom and thus a new portion of data should be loaded.

alert($("div.scroll").scrollTop()); // Always displays 0 on android


任何的想法?非常感谢!


Any idea? Thanks a lot!

推荐答案

("div.scroll").scrollTop()); //在Android上始终显示0
("div.scroll").scrollTop()); // Always displays 0 on android


任何的想法?非常感谢!


Any idea? Thanks a lot!


这篇关于scrollTop()函数在Android浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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