lib/appearlazy.js
function doReveal(el) {
      var orig = el.getAttribute('src') || false;

      el.addEventListener('error', function handler(e) {
        // on error put back the original image if available (usually a placeholder)
        console.log('error loading image', e);
        if (orig) {
          el.setAttribute('src', orig);
        }
        el.removeEventListener('error', handler); // hate this.
      });

      var src = el.getAttribute('data-src');
      if (src) {
        el.setAttribute('src', src);
        addClass(el);
        return;
      }
      src = el.getAttribute('data-bkg');
      if (src) {
        el.style.backgroundImage = 'url("' + src + '")';
        addClass(el);
        return;
      }
    }
function doReveal(el) {
      var orig = el.getAttribute('src') || false;

      el.addEventListener('error', function handler(e) {
        // on error put back the original image if available (usually a placeholder)
        console.log('error loading image', e);
        if (orig) {
          el.setAttribute('src', orig);
        }
        el.removeEventListener('error', handler); // hate this.
      });

      var src = el.getAttribute('data-src');
      if (src) {
        el.setAttribute('src', src);
        addClass(el);
        return;
      }
      src = el.getAttribute('data-bkg');
      if (src) {
        el.style.backgroundImage = 'url("' + src + '")';
        addClass(el);
        return;
      }
    }
function doReveal ( el ) { var orig = el . getAttribute ( 'src' ) || false ; el . addEventListener ( 'error' , function handler ( e ) { // on error put back the original image if available (usually a placeholder) console . log ( 'error loading image' , e ) ; if ( orig ) { el . setAttribute ( 'src' , orig ) ; } el . removeEventListener ( 'error' , handler ) ; // hate this. } ) ; var src = el . getAttribute ( 'data-src' ) ; if ( src ) { el . setAttribute ( 'src' , src ) ; addClass ( el ) ; return ; } src = el . getAttribute ( 'data-bkg' ) ; if ( src ) { el . style . backgroundImage = 'url("' + src + '")' ; addClass ( el ) ; return ; } }
set the image src or background attribute
set the image src or background attribute