I am doing animation in jquery. I have a looping picture moving from left to right of the webpage. I used following code:
function run() { $("#run").animate({ left: "980px" }, 250).animate({
left: "-600px" }, 0); setTimeout("run()", 250);
}
I want to stop the loop(OR break the function) once I press a button.
setTimeout returns a vlaue that can be used to cancel it,
Also, if just using a function, it is safer to just pass that than forcing an eval,