Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

rapportive-oss/jquery-imagefallback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

jquery-imagefallback

Encapsulate fallback behavior when images fail to load. Works with Zepto.js as well. :)

Call $('.foo').fallback on an image selector to fallback to another image if the main image fails to load.

Usage

There are two ways to use it.

  1. Specify a fallback image URL
$('img.photo').fallback('http://google.com/fallback.jpg');
  1. Specify a callback function:
    $('.photo-container > img').fallback(function () {
        $('.photo-container').hide();
    }).attr('src', 'http://my.photosite.com/image1.jpg');

About

Encapsulate fallback behavior when images fail to load.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published