Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The dropdown menu that Thesis creates is 99% fine, except that it's very unforgiving to users that don't master the use of mouse very easily - old people and people with average to bad vision. I would like to improve its usability using a bit of javascript, allowing the mouse to be a few pixels offside and still keep the submenu open. I tried this in my custom javascript file:

var hoverConfig = {    
         over: function(e){
                e.preventDefault();
                $.log("launch menu");
                $('.sub-menu',$(this)).show();
        },  
        timeout: 500, // number = milliseconds delay before onMouseOut    
        out:  function(e){
                e.preventDefault();
                $.log("hide menu");
                $('.sub-menu',$(this)).hide();
        } 
    };

    $('.sub-menu').hide();
    $("#menu-main-menu").hoverIntent( hoverConfig );

Firebug logging shows that it works - the show and hide functions are called, but the CSS behaviour still triggers and i don't manage to cancel it so that the javascript behaviour takes the full control. Any idea how i can do that?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

In fact it works; i just didn't bind the behaviour to the right element. It should be bound to the #mainmenu>li and then it works. Dumb me!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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