开发者

jQuery Preloader Animation

I want to "preload" the start page of my website with a littl开发者_运维问答e gif-animation. Its a 3-frame-piece and I want to show it right before the first page. Are there plugins to preload a page with a specific animation shown?


You don't need a plugin, or even jQuery. Just assign the image to a variable in the <script> block in the <head> of your page. JavaScript prevents the content from loading until it has done it's job, so the image will already be cached by the page visitor when the HTML is rendered:

<head>
  <script>
    var animation = new Image();
    animation.src = "images/animation.gif";
  </script>
</head>

<body>
  <div>
    <img src="images/animation.gif" alt="oooh! lookee!"/>
  </div>
</body>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜