1

I'm working on this fiddle: http://jsfiddle.net/8n2TQ/9/

It consists of a rollover button which drops down a menu like so:

$('#one').mouseenter(function() {

    //Slide down

});

The event happens immediately on hover, but I want to put in a small delay to prevent accidental hovers from triggering the event. I tried to work with a timer (see http://jsfiddle.net/8n2TQ/13/) but that doesn't seem to execute all the events under '//Slide up'. I guess I'm missing something here, what am I doing wrong?

3
  • 1
    Check out hoverIntent: cherne.net/brian/resources/jquery.hoverIntent.html Commented Dec 12, 2012 at 22:31
  • I came across the plugin but can it handle custom functions? If so how? Commented Dec 12, 2012 at 22:34
  • I see, it is indeed possible Commented Dec 12, 2012 at 22:40

2 Answers 2

3

https://github.com/briancherne/jquery-hoverIntent

There is a plugin for this that works well.

Sign up to request clarification or add additional context in comments.

Comments

2

You asked how to handle function. There is an example on thé plugin page

var config = {    
     over: makeTall, // function = onMouseOver callback (REQUIRED)    
     timeout: 500, // number = milliseconds delay before onMouseOut    
     out: makeShort // function = onMouseOut callback (REQUIRED)    
};

$("#demo3 li").hoverIntent( config )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.