jQuery changing images with animation and waiting for it to trigger hyperlink
Posted
by
user1476298
on Stack Overflow
See other posts from Stack Overflow
or by user1476298
Published on 2012-06-23T03:12:05Z
Indexed on
2012/06/23
3:15 UTC
Read the original article
Hit count: 155
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!
© Stack Overflow or respective owner