最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - HTMLCSS Wait until page is loaded - Stack Overflow

programmeradmin3浏览0评论

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: / but I was wondering if there was something even simpler.

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./snippets/jquery/display-loading-graphic-until-page-fully-loaded/ but I was wondering if there was something even simpler.

Share Improve this question asked Jan 31, 2013 at 14:57 JVE999JVE999 3,51712 gold badges61 silver badges96 bronze badges 1
  • I noticed the page you linked uses jQuery, but it's not specified above in the tags. Are you looking for a pure JavaScript solution? Also, please post any relevant code of your own in your post so we can see what you've tried. – Chase Commented Jan 31, 2013 at 15:01
Add a ment  | 

1 Answer 1

Reset to default 3

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>   
发布评论

评论列表(0)

  1. 暂无评论