sachinchoolur / lightgallery.js

Full featured JavaScript image & video gallery. No dependencies
https://sachinchoolur.github.io/lightgallery.js/
Other
5.3k stars 596 forks source link

Error when trying to change slide in vanilla JS version #132

Closed youradds closed 3 years ago

youradds commented 5 years ago

Hi,

As per your instructions, I'm trying to programatically change the slide we are on:

                    var gallery_el = document.getElementById('the-gallery');
                    window.VARS.gallery = lightGallery(gallery_el, {
                        thumbnail:true,
                        controls: true,
                        dynamicEl: window.VARS.gallery_photos,
                        download: false,
                        counter: false,
                        dynamic: true,
                        index: window.VARS.goto_slide // this works first time, but not on re-opening when you want a differentone
                    });

                    console.dir(window.lgData[gallery_el.getAttribute('lg-uid')]);
                    console.log("FOO: " + gallery_el.getAttribute('lg-uid') + " , on " + window.VARS.goto_slide)
                    window.lgData[gallery_el.getAttribute('lg-uid')].slide(window.VARS.goto_slide);

I get an error:

TypeError: t is undefined

The debug seems ok:

FOO: lg0 , on 1

I don't seem to be able to see the slide() function though, so maybe I'm missing something?

___slide: NodeList(5) ​​ 0:

​​ 1:
​​ 2:
​​ 3:
​​ 4:
​​ length: 5 ​​

: NodeListPrototype { item: item(), keys: keys(), values: values(), … } ​ el:
romanlex commented 5 years ago

+1 https://github.com/sachinchoolur/lightgallery.js/issues/134

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. If the issue is still valid for version 2.x, please re-open. Apologize for not responding on time. Thank you for your contributions.