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&load=admin-bar,hoverIntent,common,jquery-color,suggest,inline-edit-post,jquery-form&ver=26e0371f31adb44206d9f999828c9182'></script>
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.
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.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
Enjoy faster navigation!
Hope that helps.. 🙂