jquery-mobile/js/jquery.mobile.navbar.js
2010-11-11 13:33:19 -05:00

39 lines
No EOL
927 B
JavaScript
Executable file

/*
* jQuery Mobile Framework : "navbar" plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change
*/
(function($, undefined ) {
$.widget( "mobile.navbar", $.mobile.widget, {
options: {
iconpos: 'top'
},
_create: function(){
var $navbar = this.element,
$navbtns = $navbar.find("a"),
iconpos = $navbtns.filter('data-icon').length ? this.options.iconpos : undefined;
$navbar
.addClass('ui-navbar')
.attr("role","navigation")
.find("ul")
.grid({grid: $navbtns.length > 2 ? "b" : "a"});
if( !iconpos ){
$navbar.addClass("ui-navbar-noicons");
}
$navbtns
.buttonMarkup({
corners: false,
shadow: false,
iconpos: iconpos
});
$navbar.delegate("a", "click",function(event){
$navbtns.removeClass("ui-btn-active");
});
}
});
})( jQuery );