aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2011-12-20 11:49:48 -0600
committerkborchers <kris.borchers@gmail.com>2011-12-20 11:49:48 -0600
commitc88add2269c195513b1127d4e6842373fb9f6e60 (patch)
treec6cfef8f914ed2b7626b527f2e3ce3e0d6b946a8 /ui/jquery.ui.menu.js
parent76c7bf6c3ffbe4952b4cfd50443ff13745202605 (diff)
downloadjquery-ui-c88add2269c195513b1127d4e6842373fb9f6e60.tar.gz
jquery-ui-c88add2269c195513b1127d4e6842373fb9f6e60.zip
Menu: Fix close delay and increase the default delay
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js30
1 files changed, 16 insertions, 14 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index b73018a19..c5d4fd3aa 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -18,7 +18,7 @@ var idIncrement = 0;
$.widget( "ui.menu", {
version: "@VERSION",
defaultElement: "<ul>",
- delay: 150,
+ delay: 300,
options: {
menus: "ul",
position: {
@@ -332,12 +332,12 @@ $.widget( "ui.menu", {
},
blur: function( event ) {
+ clearTimeout( this.timer );
+
if ( !this.active ) {
return;
}
- clearTimeout( this.timer );
-
this.active.children( "a" ).removeClass( "ui-state-focus" );
this.active = null;
@@ -381,20 +381,22 @@ $.widget( "ui.menu", {
},
collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay( function() {
+ // if we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
- // if we were passed an event, look for the submenu that contains the event
- var currentMenu = all ? this.element :
- $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
-
- // if we found no valid submenu ancestor, use the main menu to close all sub menus anyway
- if ( !currentMenu.length ) {
- currentMenu = this.element;
- }
+ // if we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
- this._close( currentMenu );
+ this._close( currentMenu );
- this.blur( event );
- this.activeMenu = currentMenu;
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay);
},
// With no arguments, closes the currently active menu - if nothing is active