I don't like hoverIntent in the new flyout menus or admin bar; to me, it makes my page feel slow.

What would be the Wordpress-friendly way to disable hoverIntent (or change its options) in the new Wordpress admin and toolbar?

The only place I see hoverIntent in the Admin page source is here:

<script type='text/javascript' src='http://mysite.com/wp-admin/load-scripts.php?c=1&amp;load=admin-bar,hoverIntent,common,jquery-color,suggest,inline-edit-post,jquery-form&amp;ver=26e0371f31adb44206d9f999828c9182'></script>

1 Answer 1


Where is Hover Intent attached to the menus in WordPress core?

The following 2 files go about attaching hoverIntent as click handlers for the bar and menu respectively.

Admin Bar
The admin-bar.js file sets up Hover Intent on the top bar here on line 13 of admin-bar.js.

Admin Menu
The common.js file sets up Hover Intent on the side bar menu on line 185 of common.js.

How to remove HoverIntent from both the bar and menu

WordPress attaches the hoverintent handlers for the bar and menu on document ready, so if we're going to rebind those click handlers we need to make sure we do so after WordPress has done it's JS business.

The easiest way to ensure our script loads at the right time is to fire an enqueue in the admin and setting admin-bar and common scripts as dependancies.

Enqueue in admin head setting required dependancies

Attach a callback to admin_head and fire an enqueue with the two required dependancies.

add_action( 'admin_head', 'disable_admin_hoverintent' );

function disable_admin_hoverintent() {
        // Script handle
        // Script URL
        get_bloginfo( 'stylesheet_directory' ).'/disableadminhi.js', 
        // Script dependancies
        array( 'admin-bar', 'common' ) 

Create the custom Javascript file

Create a file in your theme's folder and name it to match the file in the above enqueue, in my example i've used the name disableadminhi.js, but you're welcome to adjust that and/or repoint the enqueue to somewhere else if you don't want to place it in the theme's folder.

Javascript for disableadminhi.js

    $('#wpadminbar').find('li.menupop').hover( function(){
    // Bring menu into scope(defined by common.js in wordpress)
    var menu;
    // Copy of the function from common.js, just without hoverIntent
    $('li.wp-has-submenu', menu).hover(
            var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop;

            if ( !$(document.body).hasClass('folded') && $(this).hasClass('wp-menu-open') )

            menutop = $(this).offset().top;
            wintop = $(window).scrollTop();
            maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar

            b = menutop + m.height() + 1; // Bottom offset of the menu
            h = $('#wpwrap').height(); // Height of the entire page
            o = 60 + b - h;
            f = $(window).height() + wintop - 15; // The fold

            if ( f < (b - o) )
                o = b - f;

            if ( o > maxtop )
                o = maxtop;

            if ( o > 1 )
            else if ( m.css('marginTop') )


Enjoy faster navigation!

Hope that helps.. :)

  • Now i've written the code, i'm actually enjoying the menus without HoverIntent, think i'll keep it active.. :)
    – t31os
    Dec 13, 2011 at 17:30
  • I realise now this doesn't the case where you have the admin bar frontside to, i'll be happy to update the code to cover that case if it's required though, just let me know.
    – t31os
    Dec 14, 2011 at 1:28
  • Yes—could you post how to disable it for the front-end admin bar too? This works like a charm in the admin.
    – supertrue
    Dec 22, 2011 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.