riloadr.jquery.js
/*
         * Image onerror Callback
         * If user sets 'retries' > 0, Riloadr will try to load an image n times
         * if an image fails to load.
         */
Image onerror Callback
If user sets 'retries' > 0, Riloadr will try to load an image n times
if an image fails to load.
Image onerror Callback If user sets ' retries ' > 0 Riloadr will try to load an image n times if an image fails to load .
function imageOnerrorCallback() {
            var img = this
              , loadImage = function(src) {
                    var _img = new Image;
                    _img[ONLOAD] = function() {
                        img[SRC] = _img[SRC];
                        imageOnloadCallback[CALL](img);
                    };
                    _img[ONERROR] = _img[ONABORT] = function() {
                        imageOnerrorCallback[CALL](img);
                    };
                    _img[SRC] = src;
                }
              , src;
            img[ONLOAD] = img[ONERROR] = img[ONABORT] = NULL;
            ONERROR in options && options[ONERROR][CALL](img);
            if (img[RETRIES] < retries) {
                img[RETRIES]++;
                src = getImageSrc(img, base, (img[FALLBACK] ? fallbackBreakpoint : breakpoint), TRUE);
                loadImage(src);
            } else if (FALLBACK in breakpoint && !img[FALLBACK] && fallbackBreakpoint) {
                img[RETRIES] = 0;
                img[FALLBACK] = TRUE;
                src = getImageSrc(img, base, fallbackBreakpoint);
                loadImage(src);
            } else {
                onCompleteCallback();
            }
        }
function imageOnerrorCallback ( ) { var img = this , loadImage = function ( src ) { var _img = new Image ; _img [ ONLOAD ] = function ( ) { img [ SRC ] = _img [ SRC ] ; imageOnloadCallback [ CALL ] ( img ) ; } ; _img [ ONERROR ] = _img [ ONABORT ] = function ( ) { imageOnerrorCallback [ CALL ] ( img ) ; } ; _img [ SRC ] = src ; } , src ; img [ ONLOAD ] = img [ ONERROR ] = img [ ONABORT ] = NULL ; ONERROR in options && options [ ONERROR ] [ CALL ] ( img ) ; if ( img [ RETRIES ] < retries ) { img [ RETRIES ] ++ ; src = getImageSrc ( img , base , ( img [ FALLBACK ] ? fallbackBreakpoint : breakpoint ) , TRUE ) ; loadImage ( src ) ; } else if ( FALLBACK in breakpoint && ! img [ FALLBACK ] && fallbackBreakpoint ) { img [ RETRIES ] = 0 ; img [ FALLBACK ] = TRUE ; src = getImageSrc ( img , base , fallbackBreakpoint ) ; loadImage ( src ) ; } else { onCompleteCallback ( ) ; } }
Image onerror Callback
 If user sets 'retries' > 0, Riloadr will try to load an image n times
 if an image fails to load.
Image onerror Callback If user sets ' retries ' > 0 Riloadr will try to load an image n times if an image fails to load .
// Remove event listeners from DOM image since events might not be // fired anymore. // If an image fails to load consider it loaded.