SetTimeout cancelation and restart problems
The problem I am having is I need to cancel and restart a settimeout function. Quite simply I dont know how to. If I just retype setTimeout(originalfunction(), 6000) when i later cancel it via clearTimeout(time); it continues as only the time variable one was cleard.
and if i just put time; to recall it it doesnt work. How am i supposed to recall a variable with a function in?
hope this makes sence. Thanks - James
function slide(){
var time = setTimeout( function(){
//do some stuff
recall setTimeout
}, 6000 );
}
$(function(){
$('#left').click(function(){
clearTimeout(time);
//do some stuff
recall setTimeout
});
});