For example, the user enters the page and, while not moving the mouse after a certain time, an element appears.
For example, the user enters the page and, while not moving the mouse after a certain time, an element appears.
Look at this example:
$(function() {
timeout = setTimeout(function() {
window.location.href = "http://pt.stackoverflow.com";
}, 120000);
});
$(document).on('mousemove', function() {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function() {
window.location.href = "http://pt.stackoverflow.com";
}, 120000);
});
In this code, it checks the mouse movement, if in two minutes the mouse is not moved it directs to another page using window.location.href
.
So you just have to change the code by removing window.location.href
and adding the action that shows your DIV.
Source: Perform action after 2 minutes without moving the mouse
<script type="text/javascript">
function carregar_tempo() {
document.getElementById('box').style.display='block';
}
</script>
<body onload="setTimeout('carregar_tempo()', 1000)">
<div id="box" style="display:none;">conteúdo</div>
1000 equals 1 second, just change.