How to fix a header with jQueryMobile

怎甘沉沦 提交于 2019-12-31 00:58:10

问题


I am new to jQueryMobile. I have one problem regarding fixed headers. I have this code in my header div:

<div  data-role="header" hieght="100px" data-position="fixed" data-theme="a"  style="min-height: 45px;">
    <h1>Nieuwspoort</h1>
</div>

In this div I have put data-position="fixed". The header is fixed but after I scroll the page my header is hidden and after I am done scrolling my header becomes visible again.


回答1:


Proper fixed header support has been introduced into jQueryMobile from version 1.1-rc1 onwards.

To fix your headers make sure to add the following attribute

data-position="fixed"

If you would like to disable tap-to-toggle then add the following

data-tap-toggle="false"

Your pastebin example modified to work:

<div  data-role="header" data-position="fixed" data-tap-toggle="false" data-theme="a"  style="min-height: 45px;">
  <h1>Nieuwspoort</h1>
</div> 

You need to ensure you are using 1.1-rc1 with jQuery 1.7.1



来源:https://stackoverflow.com/questions/9867677/how-to-fix-a-header-with-jquerymobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!