jQuery Mobile Navigation Bars

jQuery Mobile Navigation Bars 

A route bar comprises of a gathering of connections that are adjusted on a level plane, normally inside a header or footer:

The bar is coded as an unordered rundown of connections wrapped inside a <div> component that has the information role="navbar" attribute:


<div information role="header">
  <div data-role="navbar">
      <li><a href="#anylink">Home</a></li>
      <li><a href="#anylink">Page Two</a></li>
      <li><a href="#anylink">Search</a></li>
Try it yourself »

Icons in Navigation Buttons

To add a symbol to your route catch, utilize the data-icon attribute:


<a href="#anylink" data-icon="search">Search</a>
Try it yourself »

The information symbol characteristic utilize indistinguishable qualities from the CSS classes determined in the "Icons" part. The main contrast is that, rather than determining class="ui-symbol value", you determine the characteristic of information icon="value".

Attribute Value Description Icon
data-icon="home" Home
data-icon="arrow-r" Right Arrow
data-icon="search" Search

For a total reference of all the jQuery Mobile catch symbols, it would be ideal if you go to our jQuery Mobile Symbols Reference.

Positioning Icons

Just like with the "ui-btn-symbol position" class (determined in the "Icons" section), you can pick where the symbol ought to be situated in the route catch: top, right, base or left.

The symbol position is determined to the navbar holder - it is unimaginable to position every individual catch interface. Utilize the data-iconpos ascribe to determine the position:

Attribute Value Description Example
data-iconpos="top" Top icon alignment Try it
data-iconpos="right" Right icon alignment Try it
data-iconpos="bottom" Bottom icon alignment Try it
data-iconpos="left" Left icon alignment Try it

Active Buttons

When a connection in the navbar is tapped/clicked, it gets the chose (pushed down) look.

To accomplish this look without tapping the connection, utilize the class="ui-btn-active":


<li><a href="#anylink" class="ui-btn-active">Home</a></li>
Try it yourself »

For different pages, you may need the "selected" look for each catch that speaks to the page the client is on. To do as such, include the "ui-state-persist" class to your connections, just as the "ui-btn-active" class:


<li><a href="#anylink" class="ui-btn-dynamic ui-state-persist">Home</a></li>
Try it yourself »