jquery mobile multipage wont work

99封情书 提交于 2019-12-07 14:26:38

问题


Please help,

jquery mobile multipage wont work when a page is called from another page. It only displays the buttons but doesnt navigate to its internal pages when clicked. It works fine when the page is access directly.

<!-- Page 1-->
<div data-role="page" id="description" data-title="Description">
<div data-role="header"  data-position="fixed" data-theme="d">
<!-- header 1-->`enter code here`
</div>  
</div>
<div data-role="content">
<!--- content 1-->
</div>
<div data-role="footer"  data-position="fixed" data-theme="d">
<div data-role="navbar"  data-iconpos="bottom">
<ul>
<li><a href="#description" data-role="button" data-icon="star">Description</a></li>
<li><a href="#physicians" data-role="button" data-icon="star">Physicians</a></li>
</ul>
</div>
</div>
</div>

<!-- Page 2-->
<div id="Physicians" data-role="page" data-title="Physicians">
<div data-role="header"  data-position="fixed" data-theme="d">
<!-- header 2 -->
</div>
<div data-role="content">
<!-- content 2 -->
</div>
<div data-role="footer"  data-position="fixed" data-theme="d">
<div data-role="navbar"  data-iconpos="bottom">
<ul>
<li><a href="#description" data-role="button" data-icon="star" data-transition="pop">Description</a></li>
<li><a href="#physicians" data-role="button" data-icon="star" data-transition="pop">Physicians</a></li>
</ul>
</div>
</div>
</div>

回答1:


Try adding to the anchor the attribute rel="external".

Example:

<a href="#description" data-role="button" data-icon="star" rel="external">Description</a>



回答2:


try giving <div data-role="page" first for your second page




回答3:


When you call this page from another page, it ONLY loads the div[data-role="page"] of that page, not the other div in this multi-page file!

Actually to be precise, when you link to a page from another page, ONLY the code inside the div you are targeting is pulled in via AJAX, even if you had JS in the <head> that won't get loaded either.

Try linking to this page with an external link and you'll find it works fine.



来源:https://stackoverflow.com/questions/9142624/jquery-mobile-multipage-wont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!