jQuery setTimeout function - mouseenter/mouseleave


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $("someelement").mouseenter(function(){
  2. clearTimeout($(this).data('timeoutId'));
  3. $(this).find(".tooltip").fadeIn("slow");
  4. }).mouseleave(function(){
  5. var someelement = this;
  6. var timeoutId = setTimeout(function(){ $(someelement).find(".tooltip").fadeOut("slow");}, 650);
  7. $(someelement).data('timeoutId', timeoutId);
  8. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.