I want to create animated hover. On mouseover
I need to fadeOut div, then change its content background and color, and show it again. And on mouseout
put everything in the previous condition.
My HTML is
<div class="icon-wrapper">
<span class="icon like-icon"></span>
like
</div>
<div class="icon-wrapper">
<span class="icon comment-icon"></span>
comment
</div>
and my javaScript code
$('.icon-wrapper').hover(
function(){
$(this).animate({opacity:0}{queue:true,duration:1000,complete:function() {
$(this).find('.icon').css('backgroundPositionY','-56px');
$(this).css('color','#dd3939');
$(this).animate({opacity:1},{queue:true,duration:1000});
}});
},function(){
$(this).animate({opacity:0},{queue:true,duration:1000,complete :function() {
$(this).find('.icon').css('backgroundPositionY','-12px');
$(this).css('color','#707173');
$(this).animate({opacity:1},{queue:true,duration:1000});
}});
});
I get almost what I need. The only thing is that I want to stop animation of first div when I'm starting the animation of second.