Skip to content

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

Open
@zemzheng

Description

@zemzheng

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' ) ) );
                     }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions