npm.io
1.0.11 • Published 10 years ago

fallback-image

Licence
MIT
Version
1.0.11
Deps
0
Vulns
0
Weekly
0
Stars
1

fallback-image

Load a fallback image if an image errors out.

Build Status

Installation

$ npm install fallback-image

Usage

import fallbackImage from 'fallback-image';

let imageEl = document.querySelector('img.horse-image');
fallbackImage(imageEl, './images/fallback-image.png');

Standalone

Generate a standalone build in dist (for use with <script> tags and AMD module loaders):

$ npm run build:standalone

Test

Tests are done with tape by running:

$ npm test

Keywords