javascript - jquery timeout solution? -
let (i simplify) have 4 div content... fade/hide them if mouse left unmove 2 sec , when mouse mouve again... let quikly make appear again...
how simple make in jquery ?
i not used timetout , mouse.. more css used !
i google "concept" , find : hide div element jquery, when mouse isn't moving period of time?
i investigate if work !
you need create run-a-way timer restarts on every mousemove.
$(document).bind('mousemove', function() { var $somediv = $('#somediv'); return function() { if(!$somediv.is(':visible')) $somediv.fadein('slow'); this.tid && clearinterval(this.tid); this.tid = settimeout(function() { $somediv.fadeout('slow'); }, 2000); }; }());
Comments
Post a Comment