mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +02:00
start updating to data- driven js
This commit is contained in:
27
js/bootstrap-dropdown.js
vendored
27
js/bootstrap-dropdown.js
vendored
@@ -20,23 +20,14 @@
|
||||
|
||||
(function( $ ){
|
||||
|
||||
var d = '.dropdown-toggle'
|
||||
|
||||
function clearMenus() {
|
||||
$(d).parent('li').removeClass('open')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('html').bind("click", clearMenus)
|
||||
$('body').dropdown( '[data-dropdown] .dropdown-toggle' )
|
||||
})
|
||||
var d = '[data-dropdown]'
|
||||
|
||||
/* DROPDOWN PLUGIN DEFINITION
|
||||
* ========================== */
|
||||
|
||||
$.fn.dropdown = function ( selector ) {
|
||||
$.fn.dropdown = function () {
|
||||
return this.each(function () {
|
||||
$(this).delegate(selector || d, 'click', function (e) {
|
||||
$(this).delegate(d, 'click', function (e) {
|
||||
var li = $(this).parent('li')
|
||||
, isActive = li.hasClass('open')
|
||||
|
||||
@@ -47,4 +38,16 @@
|
||||
})
|
||||
}
|
||||
|
||||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
function clearMenus() {
|
||||
$(d).parent('li').removeClass('open')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('html').bind("click", clearMenus)
|
||||
$('body').dropdown()
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
Reference in New Issue
Block a user