Retina Bug #90

Closed
david-nguyen opened this Issue May 6, 2016 · 6 comments

Projects

None yet

4 participants

@david-nguyen

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.

@WPJobs
WPJobs commented May 6, 2016

I confirm this bug too, please fix it asap

@Mirull
Mirull commented May 6, 2016 edited

+1 (used v.1.6.1)

@WPJobs
WPJobs commented May 6, 2016 edited

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);
        }
    }
@david-nguyen

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'
}]
});
@dinbror
Owner
dinbror commented May 6, 2016

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

@dinbror
Owner
dinbror commented May 9, 2016

Back from the beach :) Fixed in v. 1.6.2

@dinbror dinbror closed this May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment