jQuery Animation not getting stopped -


fiddle

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:

  1. .stop()
  2. .stop(true)
  3. .finish()
  4. .clearqueue().stop()
  5. .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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -