Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed positioning in Android 2.3 browser should work... shouldn't it?

From looking around on the net, my understanding is that fixed positioning should work in Android 2.3 if one has the right meta tags set.

This is what my current viewport settings are.

    <meta name="viewport"
          content="width=device-width,
          height=device-height,
          initial-scale=1.0,
          maximum-scale=1.0,
          minimum-scale=1.0,
          user-scalable=no" /> 

On my Galaxy S2, the div with fixed position (basically it's a thin header at the top of the page) does not stay in place when scrolling down the page. It moves with the page.

However, when you stop scrolling, it will jump to the top of the page again.

Is that the expected fixed position behaviour for Android 2.3?

Is there a better way to do this (which hopefully doesn't involve the massive complexity of addiong iScroll)?

like image 676
Questioner Avatar asked Sep 26 '11 07:09

Questioner


2 Answers

I've just been having a look into this issue myself as part of a project we are doing: the S2 does not appear to fully support position:fixed, instead it emulates it by snapping the object back in place once the scrolling is completed (which is how we are handling it, with JS, for handsets which do not support position:fixed).

I've no idea why this is, as all the other Android 2.3 devices we have tested do support it fully with no issues, but you're not the only one having problems!

like image 99
Tom D Avatar answered Sep 23 '22 05:09

Tom D


Here is another thing that breaks position:fixed on Android 2.3

 anything{
      -webkit-transition:none !important;
 }

It only breaks when you use !important. Which sucks because

 anything{
      -webkit-transition:anything;
 }

Makes elements invisible. Hope this helps!

like image 24
Fresheyeball Avatar answered Sep 21 '22 05:09

Fresheyeball