jquery - When reset-btn is clicked, calculate-btn stops and then does not work -
when reset-btn
clicked, calculation stops after being started, doesn't work afterward. how can use restart-calculate-btn
? click reset-btn
, stop calculate-btn
after when both options selected calculate-btn
animated... calculate-btn
opacity 1
.
$(document).ready(function(){ var count = 0; $(".choose").change(function(){ count++; if(count ==2){ blink(); } }); function blink() { $(".calculate-btn").animate({ opacity: '0' }, function(){ $(this).animate({ opacity: '1' }, blink); }); } $(".reset-btn").click(function(){ $(".calculate-btn").stop(); }); }); <form> <select class="form-contol"> <option value='0'> select</option> <option value='1'> 1</option> <option value='2'> 2</option> <option value='3'> 3</option> </select> <select class="form-contol"> <option value='0'> select</option> <option value='1'> 1</option> <option value='2'> 2</option> <option value='3'> 3</option> </select> <button type="button" class="calculate-btn">claculate</button> <button type="reset" class="reset-btn">reset</button> </form>
you can use .stop() stop animation.
$("#reset").click(function(){ $(".calculate-btn").stop() .css('opacity' , 1); });
demo :http://jsfiddle.net/3jlaz/28/
i hope looking for.
Comments
Post a Comment