• Home
  • Frontend
  • Hide div element with jQuery, when mouse isn't moving for a period of time

Hide div element with jQuery, when mouse isn't moving for a period of time

linkaiyi
Follow

Hide div element with jQuery, when mouse isn’t moving for a period of time

// hide mouse after 3 seconds if not move
var i = null;
$(".canvas-wrapper").mousemove(function() {
    clearTimeout(i);
    $(".ddk-course-arrow").fadeIn(100);
    i = setTimeout(function () {
    $(".ddk-course-arrow").fadeOut(500);
    }, 2000);
}).mouseleave(function() {
    clearTimeout(i);
    $(".ddk-course-arrow").fadeOut(500);
});
Object has 0 attachments

Was this article helpful?

This article is viewed 58 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support