bootstrap/js/bootstrap-dropdown.js

26 lines
538 B
JavaScript
Raw Normal View History

2011-08-28 04:46:50 +00:00
(function( $ ){
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var selector = 'a.menu, .dropdown-toggle'
2011-08-28 04:46:50 +00:00
function clearMenus() {
$(selector).parent('li').removeClass('open')
2011-08-28 04:46:50 +00:00
}
2011-08-28 23:47:38 +00:00
$(function () {
2011-08-29 00:52:55 +00:00
$('body').bind("click", clearMenus)
2011-08-28 23:47:38 +00:00
})
2011-08-28 04:46:50 +00:00
$.fn.dropdown = function ( options ) {
return this.each(function () {
$(this).delegate(selector, 'click', function (e) {
2011-08-28 04:46:50 +00:00
clearMenus()
$(this).parent('li').toggleClass('open')
return false
})
})
}
})( jQuery || ender )