mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-30 00:29:52 +02:00
clean up js api for dropdowns
This commit is contained in:
6
js/bootstrap-dropdown.js
vendored
6
js/bootstrap-dropdown.js
vendored
@@ -27,7 +27,10 @@
|
|||||||
|
|
||||||
var toggle = '[data-toggle="dropdown"]'
|
var toggle = '[data-toggle="dropdown"]'
|
||||||
, Dropdown = function ( element ) {
|
, Dropdown = function ( element ) {
|
||||||
$(element).bind('click', this.toggle)
|
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
||||||
|
$('html').on('click.dropdown.data-api', function () {
|
||||||
|
$el.parent().removeClass('open')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Dropdown.prototype = {
|
Dropdown.prototype = {
|
||||||
@@ -51,7 +54,6 @@
|
|||||||
isActive = $parent.hasClass('open')
|
isActive = $parent.hasClass('open')
|
||||||
|
|
||||||
clearMenus()
|
clearMenus()
|
||||||
|
|
||||||
!isActive && $parent.toggleClass('open')
|
!isActive && $parent.toggleClass('open')
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
Reference in New Issue
Block a user