javascript - Display DIV only if user has been Idle for X amount of time -


i display helpful div shows user how accomplish on particular page, only if user has been idle period of time, say, 30seconds.

what mean "idle" is:

not clicking links not right clicking anywhere

exceptions: exclude following conditions user idle rule:

user has scrolled or down/left or right user has pressed mouse button on empty area on site/ or on element has no source/link example, image no hyperlink. and, pressing keyboard buttons

can done? or can detect when particullar event occurs?

any thoughts/suggestions/resources appreciated.

thank you

fairly basic...

var trigger = 30000 $.(function(){     setinterval('displayinf()',trigger );      $('body').bind('click dblclick keypress mousemove scroll', function(){         cleardisplayinf();     }); });  function displayinf() {     $('body').append('<div>your notification div</div>'); }  function cleardisplayinf() {     trigger = clearinterval(trigger);     trigger = setinterval('displayinf()', 30000 ); } 

that should trick - add script make div removable , start timer again once removed polishing really..


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -