From 8d09f750a45823f7499672076eed5b19a823e309 Mon Sep 17 00:00:00 2001 From: Marian Rudzynski Date: Sat, 1 Oct 2011 10:56:49 -0400 Subject: [PATCH] Menubar: moved mouseleave _bind call into existing _bind block, added the mouseenter binding back in to help with accidental quick mouseouts causing the menu to close and use same close time for all --- ui/jquery.ui.menubar.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js index b86ba298d..673493366 100644 --- a/ui/jquery.ui.menubar.js +++ b/ui/jquery.ui.menubar.js @@ -94,7 +94,7 @@ $.widget( "ui.menubar", { } if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) { if( that.options.autoExpand ) { - clearTimeout( that.timer ); + clearTimeout( that.closeTimer ); } that._open( event, menu ); @@ -150,18 +150,19 @@ $.widget( "ui.menubar", { focusout: function( event ) { that.closeTimer = setTimeout( function() { that._close( event ); - }, 100); + }, 150); + }, + "mouseleave .ui-menubar-item": function( event ) { + if ( that.options.autoExpand ) { + that.closeTimer = setTimeout( function() { + that._close( event ); + }, 150); + } + }, + "mouseenter .ui-menubar-item": function( event ) { + clearTimeout( that.closeTimer ); } }); - if ( that.options.autoExpand ) { - that._bind( { - "mouseleave .ui-menubar-item": function( event ) { - that.timer = setTimeout( function() { - that._close(); - }, 150 ); - } - }); - } }, _destroy : function() { -- 2.39.5