Skip to content Skip to sidebar Skip to footer

How To Scroll An Html Div Programmatically On Android 3.1?

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. A D

Solution 1:

This is a known problem with the stock Android browser:

http://code.google.com/p/android/issues/detail?id=19625

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

Solution 2:

A workaound that worked for me: first, temporarily set the overflow property to 'hidden', then set the scrollTop property, then set the overflow property back to 'scroll' (or auto). The scrollTop value seems to be kept intact and honored when the overflow property is set back to 'scroll'. This was a pretty trivial workaround that worked on all browsers I tested on (desktop and mobile). I didn't test it exhaustively, and I didn't test with transitions in place, so there may be side-effects that I haven't encountered... Your mileage may vary - but it's an easy thing to try. see: jQuery scrollTop() does not work in scrolling DIV on mobile browsers, alternatives?

Solution 3:

what I think of is that you can override onPageFinished(WebView view, String url) and inside it you can do this view.scrollTo(x, y);

Solution 4:

I had a similar issue. In the end I just placed each of my pages on top of each other using position absolute with a zindex then toggled their visibility. Sucks that bugs like this exist.

Post a Comment for "How To Scroll An Html Div Programmatically On Android 3.1?"