Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need an new option( onpreloaderror ) to see if it fail to load the image #272

Open
zemzheng opened this issue Jul 20, 2015 · 0 comments
Open

Comments

@zemzheng
Copy link

In my case I need to know if it fail to load the image.

I put the image in CDN, and if there is something wrong with CDN sync, I need to use the local image instead.

So I think it would be useful to add an option : onpreloaderror. EXP:

function swap2LocalImage( cdn_url ){
    // return the image url in local
}

$( 'img' ).lazyload({
    placeholder    : './img-default.png',
    data_attribute : 'src',
    onpreloaderror : function(){
                        var $this = $( this );
                        $this.attr( 'src', swap2LocalImage( $this.data( 'src' ) ) );
                     }
});
@zemzheng zemzheng changed the title I need to know if the image load fail I need an new option( onpreloaderror ) to see if it fail to load the image Jul 20, 2015
zemzheng added a commit to zemzheng/jquery_lazyload that referenced this issue Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant