How do I stop an animation when the animated object reaches a certain position on pag
The code in the stop count function is what I have tried so far, but it is not working since the object keeps on moving down the page. There are no error messages, I just don't get the desired behavior. I think it has something to do with the way I am trying to determine the position of the object on the page, but I am stuck.
//note setTimeout is a rather misleading name; setTimeIn would have been more appropriate;
var foo = null; // object
var t=setTimeout(doMove,20); //create a variable to hold the timeout so we can reference it later with clear clearTimeout(t);