I'm trying to run the lightgallery.js script (pure JS version) using querySelectorAll in several classes to no avail.
This is the code I'm using:
var lg = document.querySelectorAll( '.gallery-1, .gallery-2, .gallery-3');
for ( var i = 0; i < lg.length; i++ ) {
lightGallery( lg[i], {
selector: '.gallery-item > a:has(img)',
mode: 'lg-fade',
preload: 2,
counter: false,
download: false
});
}
I'm getting a "lightGallery has not initiated properly" error in the console. Before, I was using the jQuery version of the lightgallery script with no problems using $( '.gallery-1, .gallery-2, .gallery-3' ).lightGallery()
.