Admin Bar Hover Intent WordPress plugin

I’m one of the folks that doesn’t at all mind the WordPress Admin Bar, added to WordPress in version 3.1. Using it as much as I do, though, it bugs me just how sensitive the Admin Bar dropdowns are. I was in the process of fixing it for myself, when I figured it would make a nice simple plugin that others might benefit from as well.

This plugin slows down the dropdown so that it only opens up after a moment’s hesitation on the Admin Bar.┬áIt only effects logged in users, so shouldn’t add any overhead to your site.

You can download the Admin Bar Hover Intent plugin from the WordPress Plugin Directory.

That’s pretty much it, since this plugin is pretty straightforward. Hope you find it useful!

About these ads

5 thoughts on “Admin Bar Hover Intent WordPress plugin

  1. Super awesome!! That always bothered me. I don’t know why I didn’t think of this first.

    You had some issues with it loading the proper files. So I quickly rewrote it for my own use, have a look and see if you’d like to apply the changes before you push to SVN.

    add_action( ‘plugins_loaded’, ‘admin_bar_hover_activate’ );

    function admin_bar_hover_activate() {
    $hover = new Admin_Bar_Hover_Intent();
    }

    if ( !class_exists( ‘Admin_Bar_Hover_Intent’ ) ) {
    class Admin_Bar_Hover_Intent {

    const version = ’0.1′;

    function Admin_Bar_Hover_Intent() {
    $this->__construct();
    }

    function __construct() {
    add_action( ‘wp_print_scripts’, array( __CLASS__ , ‘enqueue_scripts’ ) );
    add_action( ‘init’, array( __CLASS__ , ‘enqueue_style’ ) );
    }

    function enqueue_scripts() {
    if ( is_admin_bar_showing() ) {
    wp_enqueue_script( ‘jquery’ );
    wp_enqueue_script( ‘hoverintent’, esc_url( plugins_url( ‘hoverintent.min.js’, __FILE__ ) ), array( ‘jquery’ ), ’1.0′, true );
    wp_enqueue_script( ‘rwi-adminbar-scripts’, esc_url( plugins_url( ‘rwi-adminbar-scripts.js’, __FILE__ ) ), array( ‘jquery’ ), Admin_Bar_Hover_Intent::version, true );
    }
    }

    function enqueue_style() {
    if ( is_admin_bar_showing() )
    wp_enqueue_style( ‘rwi-adminbar’, esc_url( plugins_url( ‘rwi-adminbar.css’, __FILE__ ) ), null, Admin_Bar_Hover_Intent::version, ‘screen’ );
    }
    }
    };

  2. Great minds think alike. I’ve been working on getting the Admin Bar to be delayed for some time, now, and your plugin took care of it nicely. The reason I’ve been interested in this is that I am the author of Admin Menus Fixed plugin that re-orders, groups and compresses Ozh’ Admin Drop Down Menu, the Admin Bar and the Admin Header/User Menu. The Admin Bar’s immediate default dropdown response, of course, then steps on Ozh’ menu if you overshoot. Your plugin solves that nicely and is a perfect companion to mine.

    With your permission, I’ll add a link to Admin Bar Hover Intent on my plugin readme, so that users can solve this problem easily. I’d also like to ask if later on I might be allowed to incorporate your code into mine, with obvious credit of course, so that its functionality gets implemented all at the same time. Do you think that this is agreeable?

    One bug I did find: I had to disable

    body.js-on #wpadminbar .quicklinks li:hover,
    #wpadminbar .quicklinks .selected {
    background: none;
    }

    in the CSS, as removing the dark grey background (on my theme anyway) did not allow the hovered link to display properly. The text is reversed out over the dark grey background when hovered and, with no dark background, it becomes a series of lines: white text over black text with a vertical shift.

    Might also consider adding an options screen or providing instructions in your readme for tweaking the hoverintent settings. I found that adding in:

    sensitivity: 2,
    interval: 200,

    to hoverintent config increased my accuracy with fewer “mis-mouses”. :)

    Nice work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s