mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-19 22:00:59 +00:00
jQuery core style guide conformance: jquery.mobile.navbar.js
This commit is contained in:
parent
2a232a06e0
commit
0750fc2e3b
1 changed files with 24 additions and 20 deletions
|
|
@ -4,38 +4,42 @@
|
|||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
(function($, undefined ) {
|
||||
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.widget( "mobile.navbar", $.mobile.widget, {
|
||||
options: {
|
||||
iconpos: 'top',
|
||||
grid: null
|
||||
},
|
||||
|
||||
_create: function(){
|
||||
|
||||
var $navbar = this.element,
|
||||
$navbtns = $navbar.find("a"),
|
||||
iconpos = $navbtns.filter( ":jqmData(icon)").length ? this.options.iconpos : undefined;
|
||||
|
||||
$navbar
|
||||
.addClass('ui-navbar')
|
||||
$navbtns = $navbar.find( "a" ),
|
||||
iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
|
||||
this.options.iconpos : undefined;
|
||||
|
||||
$navbar.addClass('ui-navbar')
|
||||
.attr("role","navigation")
|
||||
.find("ul")
|
||||
.grid({grid: this.options.grid });
|
||||
|
||||
if( !iconpos ){
|
||||
$navbar.addClass("ui-navbar-noicons");
|
||||
.grid({grid: this.options.grid });
|
||||
|
||||
if ( !iconpos ) {
|
||||
$navbar.addClass( "ui-navbar-noicons" );
|
||||
}
|
||||
|
||||
$navbtns
|
||||
.buttonMarkup({
|
||||
corners: false,
|
||||
shadow: false,
|
||||
iconpos: iconpos
|
||||
});
|
||||
|
||||
$navbar.delegate("a", "vclick",function(event){
|
||||
|
||||
$navbtns.buttonMarkup({
|
||||
corners: false,
|
||||
shadow: false,
|
||||
iconpos: iconpos
|
||||
});
|
||||
|
||||
$navbar.delegate( "a", "vclick", function( event ) {
|
||||
$navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass );
|
||||
$( this ).addClass( $.mobile.activeBtnClass );
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
|
|
|||
Loading…
Reference in a new issue