bigbite/macy.js

Incompatibility with LazySizes?

Closed this issue · 2 comments

Trying to use this with LazySizes and most of the images (but not all) on the page load at 1-2px height only.
What am I missing here?

jrmd commented

Hi @JayHoltslander

Sorry for the late response, although I have never used LazySizes I imagine it would be possible to get this to work if there is an event listener you can use one the image is loaded in, so you can call recalculate on the macy instance.

Once macy has calculated the image height it will ignore it for any recalculations, this was added so content loaded via ajax wouldnt cause the entire macy instance to recalculate. The only time macy will do a full recalculate by itself is on page resize. So you will manually have to call recalculate

Hope this helps.

I use LazySizes a lot since Google has gone on record as officially recommending it.