Reputation: 704
I'm trying to fade out some div elements with a class of .card when I click on a link before going to that link. The fade out works but I don't get taken to the linked page. Any ideas what I'm doing wrong?
$(document).ready(function() {
$("a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$('.card').addClass('fadeOutDown', function() {
window.location = linkLocation;
});
});
});
Upvotes: 0
Views: 895
Reputation: 240
addClass
signature is wrong. Try this:
$(document).ready(function() {
$("a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$('.card').addClass('fadeOutDown').delay(1000).queue(function(){
window.location = linkLocation;
});
});
});
Upvotes: 2