1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Formats groups of links as horizontal navigation bars.
5 //>>css: ../css/themes/default/jquery.mobile.theme.css, ../css/structure/jquery.mobile.navbar.css
8 define( [ "jquery", "./jquery.mobile.widget", "./jquery.mobile.buttonMarkup", "./jquery.mobile.grid" ], function( $ ) {
9 //>>excludeEnd("jqmBuildExclude");
10 (function( $, undefined ) {
12 $.widget( "mobile.navbar", $.mobile.widget, {
16 initSelector: ":jqmData(role='navbar')"
21 var $navbar = this.element,
22 $navbtns = $navbar.find( "a" ),
23 iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
24 this.options.iconpos : undefined;
26 $navbar.addClass( "ui-navbar" )
27 .attr( "role","navigation" )
30 .grid({ grid: this.options.grid });
33 $navbar.addClass( "ui-navbar-noicons" );
36 $navbtns.buttonMarkup({
43 $navbar.delegate( "a", "vclick", function( event ) {
44 if( !$(event.target).hasClass("ui-disabled") ) {
45 $navbtns.removeClass( $.mobile.activeBtnClass );
46 $( this ).addClass( $.mobile.activeBtnClass );
50 // Buttons in the navbar with ui-state-persist class should regain their active state before page show
51 $navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() {
52 $navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass );
57 //auto self-init widgets
58 $( document ).bind( "pagecreate create", function( e ){
59 $.mobile.navbar.prototype.enhanceWithin( e.target );
63 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
65 //>>excludeEnd("jqmBuildExclude");