Android Web App : Position:fixed broken?

后端 未结 5 1552
甜味超标
甜味超标 2020-12-04 17:47

I\'m in the process of developping a Web Application for mobiles. I went with web applications because to me it seems a winning situation having to develop one application t

相关标签:
5条回答
  • 2020-12-04 18:18

    Just add:

    <meta name="viewport" content="width=device-width, user-scalable=no" />
    

    to the page and you're set for Android 2.2+. This worked on a page I was testing on my phone. Source: When can I use CSS position:fixed?

    0 讨论(0)
  • 2020-12-04 18:28

    I confirm that using the meta name in your html header

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    

    you'll have a fixed div on scrolling vertical and horizontal on Android 2.2, 2.3 and up and iOS 4 and up. I made an example here: https://dl.dropbox.com/u/908148/website/test-scroll.html

    0 讨论(0)
  • 2020-12-04 18:31

    Just got an upgrade to Android 2.2 (Froyo) on my HTC Desire, and I'm happy to say that position fixed now works, at least when you use the viewport meta tag to set initial-scale and width. Still doesn't seem to work on regular web pages though.

    0 讨论(0)
  • 2020-12-04 18:37

    This is supposed to work :) http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/

    0 讨论(0)
  • 2020-12-04 18:43

    On my Android N1 with CyanogenMod i had this trouble too and the fix:

       <meta
         name="viewport"
         content="width=100%; 
                 initial-scale=1;
                 maximum-scale=1;
                 minimum-scale=1; 
                 user-scalable=no;"
        />
    

    Specifically the user-scalable=no; part, you can also put 0 instead of no.

    Interestingly this breaks androids rendering of buttons, but all you have to do is set a background color to buttons.

    0 讨论(0)
提交回复
热议问题