Closed nestle49 closed 2 months ago
lightgallery doesn't work
wp_enqueue_style( 'lightgallery-css', get_template_directory_uri() . '/assets/lightgallery/css/lightgallery.css', array(), _S_VERSION, true ); wp_enqueue_script( 'lightgallery-js', get_template_directory_uri() . '/assets/lightgallery/lightgallery.min.js', array(), _S_VERSION, true ); wp_enqueue_script( 'lightgallery-thumbnail-js', get_template_directory_uri() . '/assets/lightgallery/plugins/thumbnail/lg-thumbnail.min.js', array(), _S_VERSION, true ); wp_enqueue_script( 'lightgallery-zoom-js', get_template_directory_uri() . '/assets/lightgallery/plugins/zoom/lg-zoom.min.js', array(), _S_VERSION, true );
document.addEventListener('DOMContentLoaded', () => { lightGallery(document.getElementById('gallery'), { plugins: [lgZoom, lgThumbnail], speed: 500, }); const showMoreButton = document.querySelector('.gallery__show-more') showMoreButton?.addEventListener('click', () => { console.log('clc') // lightbox.open() }) })
<div id="gallery" class="photos__images h-100 d-grid flex-1 gap-24 position-relative overflow-hidden"> {% for item in gallery[1:6] %} <a class="overflow-hidden photos__item" data-src="{{- item.src -}}" > <picture class="d-flex"> <source srcset="{{- item.src|towebp(100) -}}" type="image/webp"> <img src="{{- item.src -}}" alt="{{ item.alt }}" class="br-14 overflow-hidden object-fit-cover" loading="lazy" /> </picture> </a> {% endfor %} </div>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description
lightgallery doesn't work
Steps to reproduce
JS code that you use to initialize lightGallery.
Sample HTML markup
Environment
Additional context