Simple Lightiweght jQuery Image Preloader Plugin - img_preloader
File Size: | 4.19 KB |
---|---|
Views Total: | 3715 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |

img_preloader is a lightweight and easy to use jQuery image preloader plugin that allows you to display a CSS3 powered loading spinner until all the images you specify have been completely loaded.
How to use it:
1. Load jQuery library and the jQuery img_preloader plugin at the end of the document.
<script src="//code.jquery.com/jquery-1.12.1.min.js"></script> <script src="jquery.img_preloader.js"></script>
2. Preload images using $.imgPreloader.preLoad()
method. Note that you need to use the data-src
attribute for all dynamic loading images. Available parameters:
- successCallBack: fired after all the images have been loaded
- failCallback: fired when images fail to load
<img src="" data-src="1.jpg">
$.imgPreloader.preLoad(successCallBack, failCallback)
2. Preload images using $.imgPreloader.preLoad()
method. Note that you need to use the data-src
attribute for all dynamic loading images. Available parameters:
- successCallBack: fired after all the images have been loaded
- failCallback: fired when images fail to load
3. You can also preload an array of images using $.imgPreloader.preLoadURLs()
method like this:
$.imgPreloader.preLoadURLs([1.jpg,2.jpg,3.jpg], successCallBack, failCallback)
This awesome jQuery plugin is developed by jwma. For more Advanced Usages, please check the demo page or visit the official website.