Suppose I have this animation that start at some point :
myElement.animate({ top: -currentTempImageX, left: -currentTempImageY }, 5000);
that take 5 seconds to animate! Suppose I want to stop it after 2 seconds. Can I have this control?
Thank you
Yes, you can
myElement.stop();
Link: http://api.jquery.com/stop/
If you want to stop the animation after 2 seconds then use,
setTimeout(function(){myElement.stop();}, 2000);
 
    
    User setTimeout() as suggested by Bhuvan Rikka , for stop that use clearTimeout() function .. for example see this link
 
    
    You may also check the FX queue (used for the jquery animations)
or this other topic.