Skip to content

Minty-Crisp/Image-Fallback.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Handle images not found on your website with ease!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 67.9%
  • JavaScript 32.1%