? hover-in-delay.patch Index: admin_menu.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.js,v retrieving revision 1.7.2.8 diff -u -p -r1.7.2.8 admin_menu.js --- admin_menu.js 4 Jul 2009 13:03:32 -0000 1.7.2.8 +++ admin_menu.js 18 Jul 2009 23:36:13 -0000 @@ -37,17 +37,41 @@ $(document).ready(function() { // Delayed mouseout. $('#admin-menu li').hover(function() { - // Stop the timer. - clearTimeout(this.sfTimer); - // Display child lists. - $('> ul', this).css({left: 'auto', display: 'block'}) - // Immediately hide nephew lists. - .parent().siblings('li').children('ul').css({left: '-999em', display: 'none'}); + // If we aren't already hovering, set the timer to make sure they + // *mean* to hover. + if (!this.hovering) { + var menu = this; + this.hoverInTimer = setTimeout(function() { + menu.hoverInTimer = 0; + menu.hovering = true; + // Display child lists. + $('> ul', menu).css({left: 'auto', display: 'block'}) + // Immediately hide nephew lists. + .parent().siblings('li').children('ul').css({left: '-999em', display: 'none'}); + }, 100); + } + else { + if (this.hoverOutTimer) { + // Stop the timer. + clearTimeout(this.hoverOutTimer); + this.hoverOutTimer = 0; + } + } }, function() { - // Start the timer. - var uls = $('> ul', this); - this.sfTimer = setTimeout(function() { - uls.css({left: '-999em', display: 'none'}); - }, 400); + // If they started hovering and then went out before the timer + // expired, kill it. + if (this.hoverInTimer) { + clearTimeout(this.hoverInTimer); + this.hoverInTimer = 0; + } + else { + // Start the timer. + var uls = $('> ul', this); + var menu = this; + this.hoverOutTimer = setTimeout(function() { + menu.hovering = false; + uls.css({left: '-999em', display: 'none'}); + }, 300); + } }); });