0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

make dropdowns toggle when clicked (for mobile)

This commit is contained in:
Jacob Thornton 2012-01-08 14:19:53 -08:00
parent 561fc8cf2a
commit 5a33c1b96e

View File

@ -38,12 +38,14 @@
var $this = $(this)
, selector = $this.attr('data-target') || $this.attr('href')
, $parent = $(selector)
, isActive
$parent.length || ($parent = $this.parent())
isActive = $parent.hasClass('open')
clearMenus()
!$parent.hasClass('open') && $parent.toggleClass('open')
!isActive && $parent.toggleClass('open')
return false
}