From 9b6dcbba555e234e824438d534934d935420acd1 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Thu, 24 Oct 2024 17:03:41 +0700 Subject: [PATCH] Fix issue imageLoaded is not a function --- framework/library/astroid/Document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/library/astroid/Document.php b/framework/library/astroid/Document.php index 58debfdc..7d90558c 100644 --- a/framework/library/astroid/Document.php +++ b/framework/library/astroid/Document.php @@ -945,7 +945,7 @@ public function loadMasonry($selector = ''): void } if (!empty($selector)) { $this->loadImagesLoaded(); - $wa->addInlineScript('jQuery(document).ready(function(){jQuery(\''.$selector.'\').addClass("as-loading");jQuery(\''.$selector.'\').imagesLoaded(function() { jQuery(\''.$selector.'\').masonry({itemSelector: \''.$selector.' > div\',percentPosition: true}); jQuery(\''.$selector.'\').removeClass("as-loading"); });});'); + $wa->addInlineScript('jQuery(document).ready(function(){jQuery(\''.$selector.'\').addClass("as-loading");imagesLoaded( document.querySelector(\''.$selector.'\'), function( instance ) { jQuery(\''.$selector.'\').masonry({itemSelector: \''.$selector.' > div\',percentPosition: true}); jQuery(\''.$selector.'\').removeClass("as-loading"); });});'); } } @@ -972,7 +972,7 @@ public function loadSwiper($obj = '', $config = ''): void } if (!empty($obj) && !empty($config)) { $this->loadImagesLoaded(); - $wa->addInlineScript('jQuery(document).ready(function(){jQuery(\''.$obj.'\').addClass("as-loading");jQuery(\''.$obj.'\').imagesLoaded( function() {const swiper = new Swiper(\''.$obj.'\', {'.$config.'}); jQuery(\''.$obj.'\').removeClass("as-loading"); });});'); + $wa->addInlineScript('jQuery(document).ready(function(){jQuery(\''.$obj.'\').addClass("as-loading");imagesLoaded( document.querySelector(\''.$obj.'\'), function( instance ) {const swiper = new Swiper(\''.$obj.'\', {'.$config.'}); jQuery(\''.$obj.'\').removeClass("as-loading"); });});'); } }