---
title: "jquery  预加载图片"
author: "chen_miao"
date: "2012-04-24T14:39:00Z"
tags: ["JS", "jQuery", "jquery preload", "preload"]
categories: ["Web前端"]
slug: "jquery"
draft: false
lastmod: "2012-04-24T14:39:00Z"
id: 1496730
url: "https://chen-miao.iteye.com/blog/1496730"
---

from:[http://dreamerslab.com/blog/en/preload-images-with-jquery-preload-plugin/](http://dreamerslab.com/blog/en/preload-images-with-jquery-preload-plugin/)   

#### 需求

jQuery 1.2.3+

 

#### 浏览器

#### [Firefox](http://www.mozilla.com/en-US/firefox/new/ "前往 Firefox 首頁") 2.0+

- [Internet Explorer](http://windows.microsoft.com/en-US/internet-explorer/products/ie/home "前往 Internet Explorer 首頁") 6+
- [Safari](http://www.apple.com/safari/ "前往 Safari 首頁") 3+
- [Opera](http://www.opera.com/browser/ "前往 Opera 首頁") 10.6+
- [Chrome](http://www.google.com/chrome/intl/en/landing_chrome_mac.html?hl=en "前往 Chrome 首頁") 8+

 

#### 安裝

- 首先, 確定你使用了一個有效的 [DOCTYPE](http://www.alistapart.com/articles/doctype/)
- 引用 JS 檔案

 

```
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="path-to-file/jquery.preload.js"></script>
```

 

page

  

```
$.preload( '/img/space.gif',
  '/img/loading.gif',
  '/img/header-bg.png',
  '/img/avatar.jpg'
);
```

 

OK了，详细查看附件。其实关键还是IE，因为其实浏览器速度问题，所以效果不明显