Android 2.1 address bar causes change in viewport dimensions

Posted by davehumyo on Stack Overflow See other posts from Stack Overflow or by davehumyo
Published on 2010-05-21T08:36:04Z Indexed on 2010/05/21 8:40 UTC
Read the original article Hit count: 236

Hi,

I have a page that has a 100% width and height div in it (all surrounding elements are sized accordingly so that it does actually achieve 100% width and height). Below that div I have a second div with a fixed height.

In mobile safari and blackberry everything is fine, when the page loads the dimensions are applied correctly (the top div filling the viewport) and the user can scroll down to reveal the second div. Android 2.1 also applies the dimensions correctly, but with an added quirk; when the user scrolls down and removes the address bar from the page, the dimensions of the div are recalculated to fill the viewport, causing the content to jump. Ideally I would like the dimensions of the div to remain static when the page is scrolled, but remain 100% so that it will fill the viewport regardless of device size or orientation.

Does anyone know of any way to disable this recalculation?

Thanks for any help you can provide.

© Stack Overflow or respective owner

Related posts about android

Related posts about web-design