Jquery mobile:禁用“点击切换”固定的页眉和页脚

时间:2012-05-11 04:41:37

标签: jquery-mobile

我在jquery mobile中禁用了tap切换,如下所示。

$(function(){ $('[data-role=header],[data-role=footer]').fixedtoolbar({ tapToggle:false }); });

Jquery mobile: Disable "tap to toggle" fixed header and footer

的Q之后

现在我的内容被标题截断。寻找解决方案。

6 个答案:

答案 0 :(得分:7)

当我尝试使用fixedtoolbar({tapToggle:false})以编程方式禁用taptoggle时,我遇到了同样的问题;

我很高兴在我的标题中使用data-tap-toggle =“false”标记,而不是完全禁用taptoggle。虽然添加data-tap-toggle =“false”可能还有一些工作,但至少它可以工作!

我在尝试自己解决这个问题时发现了这个问题,并决定尝试这个。我在这里找到了信息:http://jquerymobile.com/test/docs/toolbars/bars-fixed-options.html

文档在tap-toggle部分下说明:此选项也作为数据属性公开:data-tap-toggle =“true”。我决定把它设置为假,它解决了我的问题。没有更多的taptouch,没有更多的重叠!我的大多数标题现在看起来像这样:

<div data-role="header" data-id="jqmheader" data-position="fixed" data-tap-toggle="false">

答案 1 :(得分:2)

要以编程方式更改它,您需要执行以下操作:

$.mobile.toolbar.prototype.options.updatePagePadding = false;
$.mobile.toolbar.prototype.options.hideDuringFocus = "";
$.mobile.toolbar.prototype.options.tapToggle = false;

尝试使用jQuery Mobile 1.4.0

答案 2 :(得分:1)

<强> FYI
这是用JQuery以编程方式完成的:

$("[data-role=header], [data-role=footer]").fixedtoolbar({ tapToggle: true });

这将从页面容器标记中设置的默认状态切换。

答案 3 :(得分:0)

默认情况下,jquery mobile会自动计算页面填充。所以它似乎对你的页面不正确,这就是为什么内容在标题下面并且它看起来被剪裁了。

您可以通过JQM禁用页面填充的自动更新,并由您自己设置。在这里查看updatePagePadding属性:http://jquerymobile.com/test/docs/toolbars/bars-fixed-options.html

还需要进行修复,如下所述:https://github.com/jquery/jquery-mobile/issues/4223

问候。

答案 4 :(得分:0)

如果您在单个页面上调用它,则不会发生这种情况。

E.g

  

$(“#pageA,#pageB,#pageC”)。bind('pageinit',function(){               $(this).find(“[data-role = header],[data-role = footer]”)。fixedtoolbar({tapToggle:false});           });

使用1.2.0 JQM

答案 5 :(得分:0)

或者就像这样:

&#13;
&#13;
<div data-role="page" ... data-hide-during-focus="" ... >...</div>
&#13;
&#13;
&#13;

在jQuery Mobile 1.4.5上测试

相关问题