diff --git a/js/jquery.mobile.navbar.js b/js/jquery.mobile.navbar.js old mode 100755 new mode 100644 index 15b90f10370..b228c56a355 --- a/js/jquery.mobile.navbar.js +++ b/js/jquery.mobile.navbar.js @@ -12,30 +12,39 @@ $.widget( "mobile.navbar", $.mobile.widget, { }, _create: function(){ var $navbar = this.element, - $navbtns = $navbar.find("a"), - iconpos = $navbtns.filter( ":jqmData(icon)").length ? this.options.iconpos : undefined; - - $navbar + $navbtns = $navbar.find("a") + i=0, + j=0; + $navbar .addClass('ui-navbar') .attr("role","navigation") .find("ul") - .grid({grid: this.options.grid }); - - if( !iconpos ){ - $navbar.addClass("ui-navbar-noicons"); - } - - $navbtns + .grid({grid: this.options.grid }); + $navbtns.each(function(){ + var icon= $(this).attr("data-iconpos") ? $(this).attr("data-iconpos") : "top", + iconpos =$(this).filter( ":jqmData(icon)").length ? icon: undefined, + notext=$(this).filter(":jqmData(iconpos='notext')"); + if( !iconpos ){ + i++; + } + if(iconpos=="notext") { + iconpos="top"; + notext.text(""); + } + $(this) .buttonMarkup({ corners: false, shadow: false, iconpos: iconpos }); - + j++; + }); + if(i==j) + $navbar.addClass("ui-navbar-noicons"); $navbar.delegate("a", "vclick",function(event){ $navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass ); $( this ).addClass( $.mobile.activeBtnClass ); }); } }); -})( jQuery ); +})( jQuery ); \ No newline at end of file