ressio / lazy-load-xt

Lazy load XT is a jQuery plugin for images, videos and other media
http://ress.io/lazy-load-xt-jquery/
MIT License
1.36k stars 245 forks source link

iframe bug: Retina script interferes with iframe loading (Documentation "flaw") #44

Open faebe opened 9 years ago

faebe commented 9 years ago

The suggested retina script

(function($, dpr) {
  if (dpr>1)
    $.lazyLoadXT.srcAttr = 'data-src-' + (dpr > 2 ? '3x' : (dpr > 1.5 ? '2x' : '1.5x'));
})(jQuery, window.devicePixelRatio || 1);

results in the script loading a "data-src-2x" source even for videos/iframes (which of course dosn't exist). The workaround is to use a data-src-2x (and 3x) attribute for iframes. Maby the script can be changed to always load the data-src for non-images.

Tested on Safari iOS 8.2