- This topic has 7 replies, 3 voices, and was last updated 3 years, 6 months ago by Tom.
-
AuthorPosts
-
October 6, 2020 at 2:04 pm #1475294Michelle
Hi Tom,
So we just redesigned a theme to move over to GP & we had issues with a masonry blog style look where the images don’t line up & there’s space in between them.
We figured out It was the plugin A3 Lazy Load, so I posted in the FB group & others said they had the same issues with different lazy loading plugins so it sounds like it’s a GP issue.
Thanks & I hope you are well.
October 6, 2020 at 2:07 pm #1475302LeoStaffCustomer SupportHi there,
The lazy load script would need to be reloaded after masonry/infinite scroll does its thing.
Does A3 Lazy Load have any instructions relating to reloading/initiating their script under these circumstances?
October 8, 2020 at 11:01 am #1479007MichelleHi Leo,
The only thing it offers is to load it in the script & we have it set to load in the footer.
So that doesn’t help b/c there’s nothing there about reloading their script.
October 8, 2020 at 2:56 pm #1479301TomLead DeveloperLead DeveloperYou could try something like this in a Hook Element (wp_footer) hook:
<script> var masonry = jQuery( '.masonry-container' ); masonry.on( 'load', function() { masonry.masonry( 'layout' ); } ); </script>
October 9, 2020 at 11:38 am #1480963MichelleHi Tom,
How are you doing?
Yeh, but this must be a bug since it’s happening on all of those types of plugins, no? So code won’t fix it & yes we tried, but it didn’t.
Thanks
October 9, 2020 at 1:29 pm #1481098TomLead DeveloperLead DeveloperIt’s not a bug, it’s just how masonry works as far as I know. When masonry loads, it positions each grid item using absolute positioning. To do this, it needs to calculate the sizes of each grid item.
If the images aren’t there when that calculation takes place, it will be wrong and needs to be updated once the images load.
That’s why Leo asked if they offer any trigger we can hook into once an image is loaded, so we can tell masonry to recalculate.
October 14, 2020 at 6:17 pm #1489489MichelleHi Tom,
Yes, but it wasn’t just this one plugin which is why we brought it to your attention.
Unfortunately, we don’t know if there’s a trigger, but even if you fixed it for this one plugin, it’s still an issue with the other plugins.
Could it be based on the new lazy loading feature that WP has?
Maybe there’s a common feature there.
We got it working, but we had to turn it off to do that.
We just thought you should know for others & any new sites.
Thanks
Michelle
October 15, 2020 at 9:35 am #1490746TomLead DeveloperLead DeveloperI’ll play with it to see if there’s anything we can do on our end. A trigger is usually best.
Glad you got it working for now 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.