javascript - Go to page after 10 minutes of no interaction -
i creating local website (only 1 person able interact @ time) displayed on big touch screen @ office working at.
the client wants have screensaver appear on website after 10 minutes of no interaction. creating in flash actionscript 3.0. there 7 pages , 7 screensavers. tried persuade them have 1 screensaver make life whole lot easier client insists.
is possible write javascript statement says
"if no click registered after 10 minutes, go url (where flash screensaver be)".
i share links further explanation of content confidential @ stage.
if possible try hand @ writing .js code, , update section, thought check if possible first.
i have tried write javascript can't alert box appear, ideas?
function redirect(){ window.location.href = "autoplay/index.html"; } var initial=settimeout(redirect,6000); function click() { cleartimeout( initial ); alert("helo"); initial=settimeout(redirect,12000); }
i using underscore's debounce
var redirect=_.debounce(function() { location.href='myscreensaver.com/url'; },600000); jquery(document).on('click',function() { // trigger click redirect(); });
everytime click happens, redirect gets called. underscore debounce method won't call redirection function unless x time (600.000 miliseconds in case) pass between function calls. means clicks happen in between reset debounce timer , has start over.
Comments
Post a Comment