How do you stop color animations?
Ok I'm cycling an animation on a link so it appears to glow on and off, however when I mouse over it I would like the glow to stop and show the hover decoration.
Currently I have the following code which seems to ignore the stop() and as far as I can tell, the style attr is removing, but as the animation is not stopping, it's simply adding it again almost instantly.
- jQuery('#animateSpan').addClass('animateThis');
- runAnimation();
- function runAnimation(){
- jQuery('.animateThis').animate({
- color:'#fff'
- },1000,function(){
- jQuery(this).animate({
- color: '#666'
- },1000,runAnimation());
- });
- }
- jQuery('#animateSpan').hover(
- function () {
- jQuery('#animateSpan').stop();
- jQuery('#animateSpan').removeClass('animateThis');
- jQuery('#animateSpan').removeAttr('style');
- },function () {
- jQuery('#animateSpan').addClass('animateThis');
- runAnimation();
- }
- );
EDIT: Changed code to latest version, no change in effect though
Thanks in advance for any help :)