Skip to content

Wait for images to load using promises. No dependencies.

License

Notifications You must be signed in to change notification settings

awcross/images-loaded

Repository files navigation

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

About

Wait for images to load using promises. No dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published