如何用jQueryMobile修复标题 [英] How to fix a header with jQueryMobile
问题描述
我是jQueryMobile的新手。我有一个关于固定标题的问题。我有这个代码在我的头div:
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>
在这个div中,我把data-position =fixed。标题是固定的,但是在我滚动页面后我的标题被隐藏,在我完成滚动后我的标题再次变得可见。
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.1-rc1开始引入jQueryMobile。
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"
您的pastebin示例修改为工作:
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>
您需要确保使用1.1-rc1和jQuery 1.7.1
You need to ensure you are using 1.1-rc1 with jQuery 1.7.1
这篇关于如何用jQueryMobile修复标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!