The Garrus
The Garrus

Reputation: 108

White flash before page loads

Well, now its black flash, because I colored body to black. So it seems the flash comes from the background video that is not loaded yet.. But then why do i also see white flash when i go to the next page? There is no video there?

Website -> www.universityofempathy.com

Please let me know how i can fix this. I have tried hiding the body on page load and then when window is loaded, show it. But that is not fixing anything.

What iv tried:

$(document).load(function () {

    $('body').hide();
   $(window).load(function(){
        $('body').show();
});

Upvotes: 0

Views: 2152

Answers (1)

Derek Story
Derek Story

Reputation: 9583

Its most likely due to trying to hide it with JS because that in itself takes time (very short amount of time) to be performed. Instead, you should use css to handle it at the start. So you could just add:

body {
    display: none;
}

And once its ready to be shown, you run $('body').show().


Also, you should use the ready listener, not load for $(document)

Upvotes: 3

Related Questions