Martin Petrov
Martin Petrov

Reputation: 2643

jquery .hover and .delay

I want to prevent accidental activation of tooltips on hover by using .delay and .queue.

It works, except that I don't know how to stop executing the queue when you mouseout (leave the area)

$('.has_tooltip').hover(
  function(){
    $(this).toggleClass('highlight').delay(400).queue(function(next){
      $(this).children('.tooltip').show(); next();
    });
  }, 
  function(){
    $(this).toggleClass('highlight').children('.tooltip').fadeOut(200)
  }
);

Upvotes: 4

Views: 1752

Answers (1)

Peter Smeekens
Peter Smeekens

Reputation: 664

As Gidon said, http://cherne.net/brian/resources/jquery.hoverIntent.html should work just fine.

Upvotes: 2

Related Questions