JVE999
JVE999

Reputation: 3517

HTML/CSS Wait until page is loaded

I have a CSS animation with sound, however, when the page initially loads, the sound is delayed. I would like a way to wait until everything on the page has loaded before I load the page. How can I do this? I found one script here: http://css-tricks.com/snippets/jquery/display-loading-graphic-until-page-fully-loaded/ but I was wondering if there was something even simpler.

Upvotes: 0

Views: 10955

Answers (1)

John Conde
John Conde

Reputation: 219884

The link you provided is the simplest and best way to do this. No need to look for anything else.

<script>
    // Wait for window load
    $(window).load(function() {
        // Animate loader off screen
        $("#loader").animate({
            top: -200
        }, 1500);
    });
</script>   

Upvotes: 3

Related Questions