A jQuery plugin that preloads images.
JavaScript
Switch branches/tags
Clone or download
Latest commit 5c8025e Dec 12, 2013
Permalink
Failed to load latest commit information.
.gitignore add .gitignore Mar 16, 2011
CHANGELOG.md add credit Dec 11, 2013
LICENSE.txt first commit Mar 13, 2011
README.md add credit Dec 11, 2013
demo.html add min js file Mar 21, 2011
jquery.preload.js use native method to check arr obj Dec 11, 2013
jquery.preload.min.js update min version Dec 11, 2013
package.json v1.0.3 Dec 11, 2013

README.md

jQuery Preload Plugin

A jQuery plugin that preloads images.

Description

There are times that we need to preload images to bring better user experience. You will not want your users to wait for 2 seconds when they hover their mouse over the navigation menu before the background image actually appears; or keep them waiting too long when they switch a slideshow. This plugin can also be useful when you want to add more images on the page through a ajax call.

Demo

  • Please see demo.html
  • Live demo please take a look at this

Documentation

  • There is a syntax highlight version, please see this post
  • For chinese version please go here

Requires

  • jQuery 1.2.3+

Browser Compatibility

Installation

  • First, make sure you are using valid DOCTYPE
  • Include nessesary JS files
  <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>

Usage

Example code:

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

  // or

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

Credit

  • mitzip

License

The expandable plugin is licensed under the MIT License (LICENSE.txt).

Copyright (c) 2011 Ben Lin