aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-dropdown.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-09-09 22:47:49 -0700
committerJacob Thornton <[email protected]>2011-09-09 22:47:49 -0700
commit5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4 (patch)
tree105cd02ae9923fb2171f695e261e5311c81786b3 /js/bootstrap-dropdown.js
parentdf3ca4d94a69436c1d6c53f5559aefca98fb2232 (diff)
downloadbootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.tar.xz
bootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.zip
move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like
Diffstat (limited to 'js/bootstrap-dropdown.js')
-rw-r--r--js/bootstrap-dropdown.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
new file mode 100644
index 000000000..fe73e7994
--- /dev/null
+++ b/js/bootstrap-dropdown.js
@@ -0,0 +1,26 @@
+(function( $ ){
+
+ /* DROPDOWN PLUGIN DEFINITION
+ * ========================== */
+
+ var selector = 'a.menu, .dropdown-toggle'
+
+ function clearMenus() {
+ $(selector).parent('li').removeClass('open')
+ }
+
+ $(function () {
+ $('body').bind("click", clearMenus)
+ })
+
+ $.fn.dropdown = function ( options ) {
+ return this.each(function () {
+ $(this).delegate(selector, 'click', function (e) {
+ clearMenus()
+ $(this).parent('li').toggleClass('open')
+ return false
+ })
+ })
+ }
+
+})( jQuery || ender ) \ No newline at end of file