Skip to content

Latest commit

 

History

History
76 lines (40 loc) · 3.24 KB

README.md

File metadata and controls

76 lines (40 loc) · 3.24 KB

Image-Fallback.js

Image Fallback Support - Handle Image Errors With Ease

Automatically provide fallback support for all <img> / images not found!
Show your support!

Note: Currently, this library is not ready to add into your next project & needs improvements. Look back soon! If you are a Javascript developer & would like to try & address these problems look at the todo

Example and Usage

You can view a demo of Image-Fallback.js in use here.

How to use Image-Fallback.js:

Add fallback support to all images in your HTML document! Like so -

         <!--- Valid Image Path ---> 
        <img src="https://images.unsplash.com/photo-1562184647-5c4f531aef0d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60">
    
         <!--- Invalid Image Path (Image Not Found Will Show) ---> 
        <img src="test-error">

include this script at the bottom of your HTML document.

<script src="https://cdn.jsdelivr.net/gh/MarketingPipeline/Markdown-Tag/markdown-tag.js"></script> 

then you are done! All images that do not have a valid source will show a Image Not Found


How to change the error image:

To change the error image you will need to edit the script, change the image URL used in line 51 to your prefered image URL or path. Then manually host your Image-Fallback.js file with your modified changes.


Contributing GitHub

Want to improve this project? Create a pull request with detailed changes / improvements! If approved you will be added to the list of contributors of this awesome project.

See also the list of contributors who participate in this project.

License GitHub

This project is licensed under the GPL-3.0 License - see the LICENSE.md file for details.