Fix zaufane slider

This commit is contained in:
Roman Pyrih
2025-09-16 14:31:16 +02:00
parent 62e48cfa22
commit 465cddfd4c
4 changed files with 3804 additions and 3679 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1099,3 +1099,50 @@ prestashop.on('updateCart', function (event) {
// $a.replaceWith($span)
// })
// })
$(document).ready(function () {
var $widget = $('.box-ekomi-widget')
$widget.css('position', 'relative').prepend(`
<div class="preloader">
<div class="spinner owl-carousel owl-loading"></div>
<div class="preloader-text">Ładowanie recenzji, prosimy o chwilę cierpliwości…</div>
</div>
`)
function watchSlickTrack() {
var $slickTrack = $widget.find('.slick-track')
if ($slickTrack.length) {
var observer = new MutationObserver(function (mutationsList) {
mutationsList.forEach(function (mutation) {
if (
mutation.type === 'attributes' &&
mutation.attributeName === 'style'
) {
var transform = $slickTrack.css('transform')
if (transform && transform !== 'none') {
setTimeout(function () {
$widget.find('.preloader').fadeOut(500)
observer.disconnect()
}, 500)
}
}
})
})
observer.observe($slickTrack[0], {
attributes: true,
attributeFilter: ['style'],
})
} else {
setTimeout(watchSlickTrack, 200)
}
}
watchSlickTrack()
setTimeout(function () {
$widget.find('.preloader').fadeOut(500)
}, 10000)
})