Question

Say for instance I have a animation executing on hover, naturally it's easy to stop on our callback function - I need to stop the animation after 1 second, would I do this with ClearInterval? My Actual function can be seen here http://jsfiddle.net/7hujh/

$(elem).hover(function() {

  // animate

}, function () {

  // stop animating

});
Was it helpful?

Solution

Yes, just clear the interval after one second:

setTimeout(function() {clearInterval(vibrateIndex);}, 1000);

FIDDLE

OTHER TIPS

$(elem).hover(function() {

   $("#item").animate({property:value},interval).delay(1000).stop(0,0);

}, function () {

  // stop animating

});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top