Skip to content

Instantly share code, notes, and snippets.

@zanonnicola
Forked from eliperelman/LICENSE.txt
Created January 30, 2014 15:35
Show Gist options
  • Save zanonnicola/8711160 to your computer and use it in GitHub Desktop.
Save zanonnicola/8711160 to your computer and use it in GitHub Desktop.

Preloader140

A tweet-sized JavaScript Image Preloader.

To use:

var preload = function(a,b){for(a=[].slice.call(arguments),b=a.length;b--;)new Image().src=a[b]}

preload('http://www.google.com/images/logos/ps_logo2.png', 'http://localhost:8080/images/myimage.png', 'image1.jpg')
function (a,b) {
for (
a=[].slice.call(arguments), // make an array of all the supplied string URLs
b=a.length; // cache the length of the array
b--;) // iterate backwards starting with the last URL
new Image().src=a[b] // generate a new image and set its URL, preloading the image
};
function(a,b){for(a=[].slice.call(arguments),b=a.length;b--;)new Image().src=a[b]}
DO WHAT YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman <http://eliperelman.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT YOU WANT TO.
{
"name": "Preloader140",
"description": "JavaScript Image Preloader based on 140byt.es rules.",
"keywords": [
"140bytes",
"master",
"image",
"preloader",
"javascript"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment