I have a switch function with four cases: each case executes a sequence of six css changes.
How to stop it, if the viewer wants to abort, by choose another menu option?
I've done a trawl, and the closest I've come to finding something which could be adapted is from this site,
by MattEvans, a while back, buit it had to do with a loop in the function to be stopped:
create a public/global variable called "stopped", set it to false when you start the loop.
inside the loop put:
if(stopped){
break;
}
then when you press "cancel" set the stopped variable to true .
So, maybe something like
var=stopped
function wrapSwitch() {
if(stopped){ break; }
function doSwitch{ etc }
}
<a href="#" onclick=" 'stopped=true'; doMore(); return false">stop</a>
Any pointers?
Cheers.