1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/js/bootstrap-dropdown.js

26 lines
No EOL
538 B
JavaScript

(function( $ ){
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var selector = 'a.menu, .dropdown-toggle'
function clearMenus() {
$(selector).parent('li').removeClass('open')
}
$(function () {
$('body').bind("click", clearMenus)
})
$.fn.dropdown = function ( options ) {
return this.each(function () {
$(this).delegate(selector, 'click', function (e) {
clearMenus()
$(this).parent('li').toggleClass('open')
return false
})
})
}
})( jQuery || ender )