Skip to content
Snippets Groups Projects

Issue #3368173: Photo Gallery masonry Lazy loading images issue

1 file
+ 21
11
Compare changes
  • Side-by-side
  • Inline
+ 21
11
@@ -99,20 +99,17 @@
// wait for images to load
self.imgLoaded(paragraph, function() {
self.magicGrids[index] = new MagicGrid({
container: '#p-photogallery-' + i + ' .field--name-field-p-images-unlimited .field__items',
animate: true,
gutter: 0,
static: true
});
if ('loading' in HTMLImageElement.prototype) {
if (typeof self.magicGrids[index] !== 'undefined' && self.magicGrids[index] !== null) {
self.magicGrids[index].listen();
}
self.triggerMagicGrid(index);
});
} else {
self.imgLoaded(paragraph, function () {
self.triggerMagicGrid(index);
});
}
} else {
self.magicGrids[index] = null;
}
@@ -121,6 +118,19 @@
};
self.triggerMagicGrid = function (i) {
self.magicGrids[i] = new MagicGrid({
container: '#p-photogallery-' + i + ' .field--name-field-p-images-unlimited .field__items',
animate: true,
gutter: 0,
static: true,
});
if (typeof self.magicGrids[i] !== 'undefined' && self.magicGrids[i] !== null) {
self.magicGrids[i].listen();
}
};
/**
* Hide everything but the limited amount of field items
Loading