codek
codek

Reputation: 343

FadeIn content jumps on load

I'm doing a fadeOut of a full screen image. The problem is that when the wrapper fadeIn it's content (the image on the middle ) makes a jump of about 20px.

Any idea why is that happening?

This is my code:

    // Home FadeIn
    function home_timeout(){
        setTimeout(function(){
            $('#intro-image').fadeOut(700);
            $('#wrapper').fadeIn(700);
        }, 2000);
    }

It happens the first time the page is loaded and not on cache.

I have already added a height to the wrapper and still it doesn't fix it:

body.home #wrapper {
   display: none;
   height: 777px;
}

Upvotes: 0

Views: 86

Answers (2)

Dipen Dedania
Dipen Dedania

Reputation: 1450

You can try to add height to navigation list....

add
ul { height:110px; }

I hope this will fix your problem..

Upvotes: 0

A. Wolff
A. Wolff

Reputation: 74420

Instead of using display set to none, use opacity:

body.home #wrapper {
   opacity:0;
   height: 777px;
}

And then use fadeTo() method:

function home_timeout(){
        setTimeout(function(){
            $('#intro-image').fadeOut(700);
            $('#wrapper').fadeTo(700,1);
        }, 2000);
    }

Try and see...

Upvotes: 2

Related Questions