mero mero - 10 months ago 69
Javascript Question

how to load dynamic images into a slideshow

I want to create a page where the user can choose the images that will be shown in a slideshow. I'm attempting to use imgchecked.js and would like to use lightgallery.js.

How can I pass an array of images into the dynamicEL?
Is there a way to load the images using the class imgchecked?

Any help is greatly appreciated. And apologies in advance for being new at coding.

Here is a jsfiddle that only seems to be slightly working in chrome:
imgcheckbox with lightgallery -

<div class="slides">
<li><img src="001.jpg" /></li>
<li><img src="002.jpg" /></li>
<li><img src="003.jpg" /></li>
<li><img src="004.jpg" /></li>
<button id="dynamic">Launch Gallery</button>

And the JS:

$(".slides img").imgCheckbox();

$('#dynamic').on('click', function() {
dynamic: true,
dynamicEl: [{ }]

Answer Source

I couldn't make code formatting well but you can find your solution here

The idea is you have to prepare object array each time dynamic button clicked and pass that array to dynamicEL.

Note: please clean and improve sample code before use or let me know.