jQuery Mobile Framework

Navigation Search

Persistent navbars API

These pages are a demo of a persistent navbar in a fixed footer toolbar. Click on any of the links in the footer, and you'll see the page content transition. Both the persistent header and footer on these pages remain in place during the animation to a new HTML page.

To tell the framework to apply the persistent behavior, add the same data-id attribute to the header and/or footer of all HTML pages in the navigation. It's that simple: If the page you're navigating to has a header or footer with the same data-id as the page you're navigating from, the toolbars will appear fixed outside of the transition. Each of the pages in this demo has a different transition to test out how this works.

Typically, the persistent toolbar technique will be combined with fixed positioning. In this example, the footer also has a navbar, like this:

<div data-role="footer" data-id="foo1" data-position="fixed">
	<div data-role="navbar">
			<li><a href="a.html">Info</a></li>
			<li><a href="b.html">Friends</a></li>
			<li><a href="c.html">Albums</a></li>
			<li><a href="d.html">Emails</a></li>
	</div><!-- /navbar -->
</div><!-- /footer -->

To set the active state of an item in a persistent toolbar, add class="ui-btn-active ui-state-persist" to the corresponding anchor.

<li><a href="a.html" class="ui-btn-active ui-state-persist">Info</a></li>

A note about transitions

The slide, slideup, slidedown, fade or none page transitions all work great with persistent fixed toolbars. However, intensive 3D transitions like flip, turn, and flow can cause positioning and animation performance issues with this technique so we don't recommend using them.