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

26 lines
538 B
JavaScript
Raw Normal View History

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