Question

Dites par exemple, j'ai une animation exécutant sur le vol stationnaire, il est naturellement facile de s'arrêter sur notre fonction de rappel - j'ai besoin d'arrêter l'animation après 1 seconde, je ferais-moi cela avec ClearInterval?Ma fonction réelle peut être vue ici http://jsfiddle.net/7hujh/

$(elem).hover(function() {

  // animate

}, function () {

  // stop animating

});

Était-ce utile?

La solution

Oui, effacez simplement l'intervalle après une seconde:

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

Fiddle

Autres conseils

$(elem).hover(function() {

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

}, function () {

  // stop animating

});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top