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>
Try adding to the anchor the attribute rel="external"
.
Example:
<a href="#description" data-role="button" data-icon="star" rel="external">Description</a>
try giving <div data-role="page"
first for your second page
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