3

I would like to fadeOut the #portfolio-wrapper, than load the portfolio2.html with fadeIn(600). The problem is that the load function execute before the fadeOut(600). Please help me! Big thanks :)

$("a").click(function(){
    $("#portfolio-wrapper").fadeOut(600).load('portfolio2.html').fadeIn(600);
});

1 Answer 1

8

Use callbacks:

$("a").click(function(){
    $("#portfolio-wrapper").fadeOut(600, function() {
        $(this).load('portfolio2.html', function() {
            $(this).fadeIn(600);
        });
    });
});
Sign up to request clarification or add additional context in comments.

2 Comments

I have a problem... When the content fades out, the #portfolio-wrapper div loose the height, and the page jumps to top, than loads portfolio2.html...
@myrandom You could specify a min-height for your wrapper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.