Timer Handling in jQuery

Timer Handling in jQuery


One of the processes that I think you can do to get a little bit more elaborate in jQuery is to handle timers. I always forget to look it up, so here’s a note

Sample Code for Timer Handling

 inertval = 5000; //How many seconds to process (in this case, 5 seconds)

//Timer start function
function startTimer(){
Execute the syori function every //second of inertval. The information is put into the timer variable.
timer = setInterval(syori, inertval);

//Timer stop function
function stopTimer(){
Stop the //timer variable.

//Start the timer.

// Stop the timer (here we are using mouse over and out on the element as an example)
'mouseenter': function(){ //when the mouse is over, the
stopTimer(); //stop
'mouseleave': function(){ //when you mouse out
startTimer(); //Move it again

function syori(){
// Describe here the process per second of inertval