Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlapping images with masonry and imagesLoaded in Safari #816

Closed
dgobnto opened this issue Feb 8, 2016 · 7 comments
Closed

Overlapping images with masonry and imagesLoaded in Safari #816

dgobnto opened this issue Feb 8, 2016 · 7 comments

Comments

@dgobnto
Copy link

dgobnto commented Feb 8, 2016

Hello,

I'm experimenting image overlapping in Safari only. Is this a known issue?
I believe it's because of the IMG tag srcset required for retina images.

Here's a 'reduced test case', that demonstrates the issue: http://codepen.io/koiastudio/pen/WrYxKE

Thanks in advance for any help!

@desandro
Copy link
Owner

desandro commented Feb 8, 2016

Thanks for reporting this bug. Unfortunately, imagesLoaded does not yet support srcset. See desandro/imagesloaded#175. I'm closing this issue here.

@desandro desandro closed this as completed Feb 8, 2016
@dgobnto
Copy link
Author

dgobnto commented Feb 8, 2016

Thanks for the reference.
In the meanwhile I've came up with a temporary fix.
Instead of initializing the js with $(document).ready(), $(window).load() kind of does the trick.

@ProtocolNebula
Copy link

ProtocolNebula commented Feb 13, 2017

I'm trying to fix the first load in Safari MAC, but I fixed it in iOs Safari, maybe this will help you:

if (navigator.userAgent.indexOf("Safari") > -1) {
        mas.masonry('reloadItems'); 
        mas.masonry('layout'); 
}

I hope it help you for some bug.

PS: You help mi with ".load()", thanks :)

@yairza
Copy link

yairza commented Apr 19, 2017

Unfortunately $(window).load() happens a lot after $(document).ready() , making it to load slower.
@ProtocolNebula can you give more details on where you added this code snippet?

@ProtocolNebula
Copy link

Hi.
Sorry, I don't remember what I done exactly.
I had to make some changes to simulate a "fix" (and it still fails sometimes), you can check the "fixed code" (until I found a nice solution or page down) here: http://siichic.com/site/js/genericos.js

I hope it helps you.

@desandro
Copy link
Owner

window.load is a last resort, I recommend using imagesLoaded

@ProtocolNebula
Copy link

I'm already using imagesLoaded, but seems not work correctly without "fixes" and still fails in iPad when connection is slow (or other cases, I'm not sure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants