images-loaded

1.0.0 • Public • Published

images-loaded Build Status

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

Package Sidebar

Install

npm i images-loaded

Weekly Downloads

103

Version

1.0.0

License

MIT

Unpacked Size

9.01 kB

Total Files

5

Last publish

Collaborators

  • awcross