Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iScroll does not work in android unless you do a orientation change and back

hi i have a website i created and it is using iScroll so basically i have a fixed width on a div tag, and it will become scroll-able if the content is too long.

the same code i have iscroll applied works fine on iphone and ipad

however, on android, when the webview is first loaded in portrait mode it is not scrollable, but if you put it in landscape, and then back to portrait, then you are able to scroll.

why orientation change in android affect iScroll? how can i fix this for android?

like image 512
user1233587 Avatar asked Nov 03 '22 23:11

user1233587


1 Answers

The #wrapper on which you defined iscroll should be fixed and the immediate child div should take the total width of the content. Try initializing the iscroll after the content is rendered and the width is calculated if there is any dynamic loading and then call the iscroll refresh() method after iscroll is initialized. Let me know if i got your problem right and this solves your issue. Define absolute position.

like image 141
user850234 Avatar answered Nov 09 '22 11:11

user850234