Skip to content

hughsk/image-loaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image-loaded

browser support

Call a callback when an image has loaded - adapted from desandro/imagesloaded, minus the jQuery.

Installation

Using npm and browserify:

npm install image-loaded

Usage

require('image-loaded')(image, callback)

var loaded = require('image-loaded')
var image = document.getElementById('hidden-image')

loaded(image, function(err, alreadyLoaded) {
  // image is loaded!
})

If the image was already loaded beforehand, the callback will be called instantly with the second argument set to true. Otherwise this will be false.

About

Call a callback when an image has loaded

Resources

Stars

Watchers

Forks

Packages

No packages published