jQuery Animation not getting stopped -
please take @ above fiddle. want make blinking led stop (opacity
1
) animating once click on stop!
button.
weirdly enough, doesn't work time. animation keeps on rolling if stop
button clicked.
things tried:
- .stop()
- .stop(true)
- .finish()
- .clearqueue().stop()
- .clearqueue().finish()
any clue may wrong.?
thanks!
it seems work using clearqueue() , finish(), see if it's fit needs:
$('#start').click( function(){ animation(); }); $('#stop').click(function() { $led = $('.led-green'); $led.animate({opacity: 1},100, function(){ $led.clearqueue(); $led.finish(); }); }); function animation(){ $('.led-green').animate({opacity: 0.5}, 500) .animate({opacity: 1}, 500, function(){ animation(); }); }
you can check fiddle here
Comments
Post a Comment