jquery-mobile/js/jquery.mobile.navbar.js

41 lines
919 B
JavaScript
Raw Normal View History

/*
2010-11-10 00:55:52 +00:00
* jQuery Mobile Framework : "navbar" plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function($, undefined ) {
2010-10-28 01:58:00 +00:00
$.widget( "mobile.navbar", $.mobile.widget, {
options: {
iconpos: 'top',
grid: null
2010-10-28 01:58:00 +00:00
},
_create: function(){
var $navbar = this.element,
$navbtns = $navbar.find("a"),
2010-11-11 21:36:25 +00:00
iconpos = $navbtns.filter('[data-icon]').length ? this.options.iconpos : undefined;
$navbar
2010-10-28 01:58:00 +00:00
.addClass('ui-navbar')
.attr("role","navigation")
.find("ul")
.grid({grid: this.options.grid });
2010-10-28 01:58:00 +00:00
if( !iconpos ){
$navbar.addClass("ui-navbar-noicons");
}
$navbtns
.buttonMarkup({
corners: false,
shadow: false,
iconpos: iconpos
});
2010-10-28 01:58:00 +00:00
$navbar.delegate("a", "click",function(event){
$navbtns.removeClass( "ui-btn-active" );
$( this ).addClass( "ui-btn-active" );
2010-10-28 01:58:00 +00:00
});
}
});
})( jQuery );