【问题标题】:Jquery Mobile 1.4.1 dynamic headerJquery Mobile 1.4.1 动态标头
【发布时间】:2014-03-22 11:30:34
【问题描述】:

我正在尝试在 jquery mobile 1.4.1 中动态附加我的标题 (date-role=header)。我在它的右侧添加了一个按钮,我正在使用$('#page').trigger('pagecreate'),以便使用新按钮重新创建标题并具有 jquery 移动样式。这在 jquery mobile 1.3.2 中有效,但在 1.4.1 中无效。我尝试了新的enhanceWithin() 功能,但它仍然无法正常工作。我也试过$('#header').enhanceWithin(),但也没有用。我知道 trigger('create') 方法已被弃用,但我似乎无法弄清楚如何让它与新的 enhanceWithin() 函数一起使用

【问题讨论】:

  • 奇怪,在1.4.1 documentation 中它似乎在演示中运行良好。他们使用的是 jQuery 1.9.1,但我怀疑这很重要..你能分享一下你何时以及如何创建按钮的代码吗?

标签: jquery jquery-ui jquery-mobile cordova ios7


【解决方案1】:

在 jQuery Mobile 1.4 中插入工具栏的方式不同,.toolbar() 函数应该在动态插入的页眉/页脚上调用。

$("[data-role=header], [data-role=footer]").toolbar();

然后,页面的高度应该被重置,因为工具栏向页面添加填充,导致页面滚动。

$.mobile.resetActivePageHeight();

.trigger("pagecreate").trigger("create") 已弃用并替换为 .enhanceWithin()。应该在包含动态添加元素的 parent div 上调用新函数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-15
    • 1970-01-01
    相关资源
    最近更新 更多