I have 2 galleries in wordpress, elementor. I want to merge them into one. Don't ask why :) I'm using this js, it works perfectly, but only if I'm logged in wp. But when I log out, the js doesn't work and the lightbox takes over the original lightbox from elementor.
Does anyone know what to do about this please?
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/css/lightbox.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/js/lightbox.min.js"></script>
<script>
const galleryLinks = Array.from(document.querySelectorAll('.elementor-image-gallery a[data-elementor-open-lightbox="yes"]'));
galleryLinks.forEach(link => {
console.log(link.href);
link.setAttribute('data-lightbox', 'gallery'); // Přidání atributu pro Lightbox galerii
});
lightbox.option({
'resizeDuration': 200,
'wrapAround': true,
'showImageNumberLabel': false
});
</script>
I've tried everything...