1
For example, the user enters the page and, while not moving the mouse after a certain time, an element appears.
1
For example, the user enters the page and, while not moving the mouse after a certain time, an element appears.
1
Look at this example:
$(function() {
timeout = setTimeout(function() {
window.location.href = "http://answall.com";
}, 120000);
});
$(document).on('mousemove', function() {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function() {
window.location.href = "http://answall.com";
}, 120000);
});
In this code, checks the movement of the mouse, 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 the window.location.href
and acquiring the action that shows your DIV.
0
About getting the mouse stopped I don’t know anything specific but you can do a javascript to display the div after some time... follow example:
<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, only change.
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
i tried that $('.test'). Hide(). delay(1000). fadein 9000 in case it gets automatically presenting
– Michelly Sabatiny
I have the home screen ...if you do not move the mouse a div appears above the telainicial ...but this div can only appear if the person is a while without moving the mouse...
– Michelly Sabatiny