jQuery changing images with animation and waiting for it to trigger hyperlink
- by user1476298
I want to switch images on .click() using the url attr I can do so, but I can't figure out how to make it wait, until the animation is done to redirect to the new webpage.
Here's the js
$(function() {
$('.cv').click(function(){
$("#cv img").fadeOut(2000, function() {
$(this).load(function() { $(this).fadeIn(); });
$(this).attr("src", "images/cv2.png");
return true;
});
});
});
Here's the html:
<div id="cv" class="img one-third column">
<a class="cv" target="#" href="cv.joanlascano.com.ar">
<img src="images/cv1.png" alt="Curriculum"/>
<br />CV</a>
</div>
Thank you in advantage!