0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/js/bootstrap-dropdown.js

26 lines
538 B
JavaScript
Raw Normal View History

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