【发布时间】:2016-01-31 08:15:53
【问题描述】:
我正在使用 jquery mobile 创建一个 apache cordova 应用程序。 我有一个登录页面,成功登录后,页面使用 $( ":mobile-pagecontainer" ).pagecontainer("change", "mainpage.html");$(":mobile-pagecontainer").pagecontainer("change", "mainpage.html"); em> 在 mainpage.html 上,我有一个使用导航栏的多页模板。代码如下:-
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- jQuery Mobile -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<div data-role="page" id="pageone">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
<div data-role="navbar">
<ul>
<li><a href="#" class="ui-btn-active" data-icon="home" rel="external" data-ajax="false">Home</a>
</li>
<li><a href="#pagetwo" data-icon="arrow-r" rel="external" data-ajax="false">Page Two</a>
</li>
</ul>
</div>
</div>
<div data-role="main" class="ui-content">
<p>With the ui-btn-active class, notice that the Home button stays highlighted (selected).</p>
<p>If you click on the Page Two, you will notice that none of the buttons are highlighted (selected).</p>
</div>
<div data-role="footer">
<h1>My Footer</h1>
</div>
</div>
<div data-role="page" id="pagetwo">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
<div data-role="navbar">
<ul>
<li><a href="#pageone" data-icon="home" rel="external" data-ajax="false">Home</a>
</li>
<li><a href="#" data-icon="arrow-r" rel="external" data-ajax="false">Page Two</a>
</li>
</ul>
</div>
</div>
<div data-role="main" class="ui-content">
<p>No buttons are pre-selected (highlighted) in this page..</p>
<p>To get the selected look for each button that represents the page you are actually on, go back to our navbar tutorial and read the next step to find out how!</p>
</div>
<div data-role="footer">
<h1>My Footer</h1>
</div>
</div>
问题是,当我点击 第二页 选项卡时,它不会在第一次加载。再次单击它时,它会加载 ID 为 page two
的 div能否请您帮我纠正第一次单击时无法加载第二页的问题?
【问题讨论】:
-
请编辑您的帖子以明确说明,该问题仅在页面加载
$( ":mobile-pagecontainer" ).pagecontainer("change", "mainpage.html");并添加上一页的相关代码时发生。
标签: apache cordova jquery-mobile navigation intel-xdk