Update Masonry plugin and portfolio

This commit is contained in:
Aroy-Art 2024-02-12 18:32:56 +01:00
parent 77d4252b75
commit ff604db53f
Signed by: Aroy
GPG key ID: 583642324A1D2070
3 changed files with 61 additions and 29 deletions

View file

@ -12,6 +12,21 @@ $(window).on('load', function () {
const observer = lozad(); // lazy loads elements with default selector as ".lozad"
observer.observe();
/* ========================================================================= */
/* init Masonry for blog list
/* ========================================================================= */
var grid = document.querySelector('.blog-post');
if (grid) {
var msnry = new Masonry(grid, {
percentPosition: true
});
imagesLoaded(grid).on('progress', function() {
// layout Masonry after each image loads
msnry.layout();
});
}
/* ========================================================================= */
/* Image Preloader
@ -21,7 +36,6 @@ function imgIsLoaded(imgElement) {
$(imgElement).removeClass("unloaded");
}
/* ========================================================================= */
/* Code Copy Button
/* ========================================================================= */
@ -231,4 +245,4 @@ jQuery(function ($) {
counter();
});
});
});