Possible Duplicate:
Jquery if conditions false then prevent default
I have this code, it's running fine but I want it to be dynamic.
$(".nav a").click(function () {     
    var getid = $(this).attr('id');
    $("#background-wrapper").fadeOut("slow");
    $("#page_box").fadeOut("slow");         
    $("header").fadeOut("slow");
    $("footer").fadeOut("slow", function () {
        window.location = getid+".php";
    });
});
I want to execute the fade out first before directing it using the href.
What I want is this first
$(".nav a").click(function () {     
    var getid = $(this).attr('id');
    $("#background-wrapper").fadeOut("slow");
    $("#page_box").fadeOut("slow"); 
    $("header").fadeOut("slow");
    $("footer").fadeOut("slow");
});
then trigger this after
.nav a = href = "link"
 
     
     
     
     
    