How does one get a fixed header to stay at the top of the page?

前端 未结 2 1750
挽巷
挽巷 2021-01-24 23:18

The fixed header will not stay at the top of the page for me. It sits on top of a page that has several number inputs that were added via javascript. As the user fills out the

相关标签:
2条回答
  • 2021-01-24 23:49

    The data-position="fixed" is used to make those smartphone-like headers that disapear with some clicks on body or some other events i dont care,

    for what you want, you can just style your header with css with something like:

    #myheader{
     position: fixed !important;
     width:100%;
     top: 0px;
    }
    

    Works like a charm

    PS: The !important overwrites any jquerymobile attempt to change position attribute, it may not be needed

    0 讨论(0)
  • 2021-01-25 00:07

    Had you tried to also include the all three attributes to your header? It works for me with all these specified:

    • data-position="fixed"
    • data-tap-toggle="false"
    • data-update-page-padding ="false"

    Here is the code:

    <div data-role="header" data-position="fixed" data-tap-toggle="false" data-update-page-padding ="false"> </div>
    

    Hope this help!

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