1 (function( $, undefined ) {
3 $.widget( "mobile.navbar", $.mobile.widget, {
7 initSelector: ":jqmData(role='navbar')"
12 var $navbar = this.element,
13 $navbtns = $navbar.find( "a" ),
14 iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
15 this.options.iconpos : undefined;
17 $navbar.addClass( "ui-navbar ui-mini" )
18 .attr( "role", "navigation" )
21 .grid({ grid: this.options.grid });
23 $navbtns.buttonMarkup({
30 $navbar.delegate( "a", "vclick", function( event ) {
31 if ( !$(event.target).hasClass( "ui-disabled" ) ) {
32 $navbtns.removeClass( $.mobile.activeBtnClass );
33 $( this ).addClass( $.mobile.activeBtnClass );
37 // Buttons in the navbar with ui-state-persist class should regain their active state before page show
38 $navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() {
39 $navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass );
44 //delegate auto self-init widgets
45 $.delegateSelfInitWithSingleSelector( $.mobile.navbar );