images-loaded
v1.0.0
Published
Wait for images to load using promises
Downloads
456
Maintainers
Readme
images-loaded
Wait for images to load using promises
Install
$ npm install --save images-loaded
Usage
const imagesLoaded = require('images-loaded');
imagesLoaded('.container').then(elements => {
// images are hot and ready
});
API
imagesLoaded(input [, options])
Returns a Promise
when all images are done loading, with or without errors.
input
Type: string
Element
NodeList
A container or list of elements
to watch for loading images.
options
Type: Object
props
Type: string[]
Default: []
Can be passed a list of DOM style camelCase properties to check. For example, backgroundImage
, borderImage
, etc.
attrs
Type: string[]
Default: []
Can be passed a list of attributes to check, such as poster
in a video tag.
Browser Support
If your browser supports Promise
then 🎉. Check it at caniuse.com.
License
MIT © Alex Cross