It is necessary that the elements disappear when the user does not move the mouse for 5 seconds and that they are shown back as soon as the mouse moves (and so on in a circle).
Maybe there are ready-made plugins or solutions for this problem?
It is necessary that the elements disappear when the user does not move the mouse for 5 seconds and that they are shown back as soon as the mouse moves (and so on in a circle).
Maybe there are ready-made plugins or solutions for this problem?
You can add the autohide class to all the elements you need to hide and add this code to the page:
var timeout = null; $(document).on('mousemove', function() { if (timeout !== null) { $(".autohide").show(); clearTimeout(timeout); } timeout = setTimeout(function() { $('.autohide').hide(); timeout = null; }, 5000); }); I don't know the finished plug-ins, but you should probably start from this and from setTimeout
Source: https://ru.stackoverflow.com/questions/483821/
All Articles