jQuery Plugin To Replace Broken Image With A Placeholder - imageFallback

File Size: 4.32 KB
Views Total: 761
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Replace Broken Image With A Placeholder - imageFallback

imageFallback is a jQuery plugin for handling 404 images that allow you to set any number of fallback image placeholders for broken images within the document. The goal is to display a custom image placeholder which will be loaded in the event that the original image fails to load.

Basic usage:

1. Load jQuery library and the jQuery imageFallback plugin in the html document when needed.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jQuery-imageFallback.js"></script>

2. Call the function on the IMG and specify an array of fallback images you want to use.

$('#img').imageFallback(['1.jpg', '2.png']);

This awesome jQuery plugin is developed by sullenfish. For more Advanced Usages, please check the demo page or visit the official website.