-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Images overlapping with lazy load #1165
Comments
When I was working on a it I found that using image placeholders in the lazy laod was the way to go. |
|
try this in file (function ($) {
"use strict";
$(document).ready(function () {
// init Masonry
var $grid = $('.msnry-grid').masonry({
itemSelector: '.msnry-grid-item',
columnWidth: '.msnry-grid-sizer',
percentPosition: true,
});
// layout Masonry after each image loads
$grid.find('[loading="lazy"]').on('load', function() {
$('.msnry-grid').masonry('layout');
})
});
})(jQuery); |
This works (without lazy load):
https://codepen.io/jo-libertaire/pen/zYPjWYw
But images are overlapping as soon as I enable lazy load:
https://codepen.io/jo-libertaire/pen/qBVYpKB
What am I doing wrong?
The text was updated successfully, but these errors were encountered: