aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-dropdown.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2011-10-09 21:25:50 -0700
committerMark Otto <[email protected]>2011-10-09 21:25:50 -0700
commit7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d (patch)
tree03713b4dce199652857e7f28487756037d814438 /js/bootstrap-dropdown.js
parentdd1efdf0d5ec2469978a65c845cc5dfd16b74899 (diff)
parentc9669be1ec2862b88ffdb296191e82fed79f56a4 (diff)
downloadbootstrap-7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d.tar.xz
bootstrap-7c98f1e1fccbb9664bddbc64edb626ffdcf8fe7d.zip
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Diffstat (limited to 'js/bootstrap-dropdown.js')
-rw-r--r--js/bootstrap-dropdown.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
index 75320c0f8..6379653c5 100644
--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -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 ) \ No newline at end of file