dinbror/blazy

Retina Bug

david-nguyen opened this issue · 6 comments

I'm pretty sure there is a bug with the retina, because you are calling handleSource to set the src, it calls the original dataSrc and not the split version.

I confirm this bug too, please fix it asap

+1 (used v.1.6.1)

i believe it is related to this message from changelog:

Marked breakpoints as obsolete. Will be removed in upcoming version. Use srcset and/or the picture element instead.

p.s. here is a hotfix of problem (if you can't replace src with srcset immediately):

function handleSource(ele, attr, dataAttr) {
        var dataSrc = ele.getAttribute(dataAttr);

        if (dataSrc) {

                var dataSrcSplitted = dataSrc.split('|');
                var dataSrc = dataSrcSplitted[isRetina && dataSrcSplitted.length > 1 ? 1 : 0];

            ele[attr] = dataSrc;
            ele.removeAttribute(dataAttr);
        }
    }

Thanks for the code, I took a look I think this is what the author is referring to for breakpoints

// Example
var bLazy = new Blazy({ 
    breakpoints: [{
          width: 420 // max-width
    , src: 'data-src-small'
     }
       , {
          width: 768 // max-width
        , src: 'data-src-medium'
}]
});

Hey guys.

You're right. I'll fix it when I'm home from the Beach tomorrow. You can use 1.5.x or @WPJobs's hotfix until

Back from the beach :) Fixed in v. 1.6.2