Created
January 16, 2012 03:48
-
-
Save MilkZoft/1618953 to your computer and use it in GitHub Desktop.
Preloading images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| var cache = []; | |
| $.preLoadImages = function() { | |
| var argsLen = arguments.length; | |
| for(var i = argsLen; i--;) { | |
| var cacheImage = document.createElement('img'); | |
| cacheImage.src = arguments[i]; | |
| cache.push(cacheImage); | |
| } | |
| } | |
| } | |
| jQuery.preLoadImages("img1.gif", "/path/to/img2.png"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment