如何在Android 3.1编程滚动一个HTML DIV? [英] How to scroll an HTML DIV programmatically on Android 3.1?

查看:137
本文介绍了如何在Android 3.1编程滚动一个HTML DIV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能让Android上的以下工作3.1 /蜂窝(仅限Android版测试过),但它工作在其他地方 - 包括其它基于WebKit的浏览器,例如在iPhone上。

I can't make the following work on Android 3.1/Honeycomb (only Android version tested), but it works everywhere else - including on other WebKit-based browsers, e.g. on iPhone.

尺寸固定的DIV:

<DIV id="TestDiv" style="width:300px;height:200px;overflow:auto;">Lorem ipsum dolor sit amet, etc.</DIV>

JavaScript或jQuery的A线滚动下来页面加载后:

A line of JavaScript or jQuery to scroll it down after page has loaded:

document.getElementById("TestDiv").scrollTop = 100;
$("#TestDiv").scrollTop(100);

我也试过包装上面从页面的加载一个的setTimeout 来引入一个小的延迟。它有时需要与WebKit的,但它并没有任何帮助。

I also tried wrapping the above in a setTimeout to introduce a small delay from the loading of the page. It is sometimes needed with webkit, but it did not help here.

我的有无的纲领性看到滚动DIV在我的Andr​​oid 3.1的工作。设备所以我知道它的可以的来完成。现在的问题是怎么了?

I have seen programmatic DIV scrolling work on my Android 3.1. device so I know it can be done. The question is how?

编辑:请注意,我找了一个网络的解决方案,也适用于股票浏览器的Andr​​oid,的的原生Android解决方案

Please notice, I am looking for a web solution that also works in the stock browser of Android, not a native Android solution.

推荐答案

这是一个已知的问题与股票Android浏览器:

This is a known problem with the stock Android browser:

HTTP://$c$c.google。 COM / p /安卓/问题/细节?ID = 19625

最好的解决办法可能是等待,直到它是由谷歌固定的,而不是试图找出黑客攻击。

The best solution is probably to wait until it is fixed by Google, rather than trying to figure out a hack.

这篇关于如何在Android 3.1编程滚动一个HTML DIV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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