开发者

jquery .hover and .delay

开发者 https://www.devze.com 2023-02-03 14:38 出处:网络
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

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

精彩评论

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