I have written a JQuery program that, on the press of a button, runs a dozen or so setTimeout's as well as a few animations. The program operates on existing div's, changes their HTML (using id selectors), fades in, fades out, etc...
The entire process can take up to 15 seconds. The problem is that if the button is pressed again within that time frame then the fade ins and outs start piling on top of each other and looking weird.
Is there something that I can use so that if the button is pressed again then all JQuery stuff in progress just stops and is cleared out? I have tried using clearTimeout, which doesn't seem to work.