【问题标题】:jQuery Mobile data-role=page within a data-role=pagejQuery Mobile data-role=page 内的 data-role=page
【发布时间】:2014-07-03 07:47:45
【问题描述】:

我有一个带有 data-role="page" 的父 div,它的内容也有自己的 data-role="page"。是否可以在内容区域的data-role="page" 内导航而不使父 div 导航?

例如,

<div id="main" data-role="page">

title goes here

<div id="content_1" data-role="subpage">

 content goes here

</div>
<!--/#content_1 -->

<div id="content_2" data-role="subpage">

 content goes here

</div>
<!--/#content_2 -->

</div>
<!-- /#main -->

基本上我只想在#content_1#content_2 之间导航,而#main 将只保留/保留以及标题。

【问题讨论】:

  • 也许只是通过 jQuery 隐藏/显示 2 个 subpage div,基于您的特定页面逻辑,即点击或其他事件 $('#content_1').toggle(); $('#content_2').toggle(); 记得还要添加 #content_2{display:none;} ass CSS 开头。
  • @RobSchmuecker 将其作为答案,以便我可以 +1
  • 我希望它具有与 data-role="page" 相同的过渡效果,例如添加特定的数据过渡。这可能吗?
  • 谢谢@MauricePerry,完成并完成:)

标签: jquery jquery-mobile mobile


【解决方案1】:

也许只是根据您的特定页面逻辑(即点击或其他事件$('#content_1').toggle(); $('#content_2').toggle();)通过 jQuery 隐藏/显示 2 个子页面 div,记得还要添加 #content_2{display:none;} 作为 CSS 开头。

此外,如果您想要在正常页面之间加载时获得本机转换等,您应该考虑在此处找到的插件/小部件 https://github.com/ToddThomson/jQuery-Mobile-Subpage-Widget

【讨论】:

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