开发者

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)
  }
);


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜