How to know when an object opacity reaches a value of 0 using jQuery -
i have object gradually goes transparent , set callback function when object's opacity reaches value of 0, can reset opacity , position when completed.
here code far:
var angle = 0; var reverseangle = 0; setinterval(function(){ angle+=3; reverseangle-=3; $("#part1, #part3, #part5, #part7").rotate(angle); $("#part4, #part2").rotate(reverseangle); $("#part9").animate({ opacity: "-=0.1", top: "-=1" }, 800); },50);
you can add callback function end of animation.
$("#part9").animate({ opacity: "-=0.1", top: "-=1" }, 800, function(){ if($(this).css("opacity") <= 0){ stuff } } );
i added <=
, in case
Comments
Post a Comment