I will finding solution for click button and open gallery and integrated from lightslider
I not sure It's possible to do like this.
Anyone can suggestion?
Thanks
Hi,
Use lightGallery dynamic mode
Demo : http://sachinchoolur.github.io/lightGallery/demos/dynamic.html
Trigger click event with jQuery :
$('#mybutton').on('click', function() {
$('.first-item').trigger('click');
});
Hi Sachin,
I tried to trigger click event with jQuery using Method 2 you mentioned above but it didn't work. Please review my code.
I have a Zoom icon with id "zoom-btn":
<div class="zoom-btn">
<span class="fa fa-search" aria-hidden="true">
</div>
For the script:
` `
I clicked on the button and it didn't run. Please give me some suggestions.
Thanks,
Giang
Hi Sachin,
I tried to trigger click event with jQuery using Method 2 you mentioned above but it didn't work. Please review my code.
I have a Zoom icon with id "zoom-btn":
<div class="zoom-btn"> <span class="fa fa-search" aria-hidden="true"> </div>
For the script:
` `I clicked on the button and it didn't run. Please give me some suggestions.
Thanks,
Giang
You have a class name zoom-btn not an id, to reference a class use $('.zoom-btn') and for id use $('#zoom-btn') jquery selector.
Here is a snippet without using jquery in case anyone is looking for in the future:
document.querySelector(".startGalleryBtn").addEventListener('click', function() {
var startGalleryEvent = new CustomEvent('click', {bubbles: true, cancelable: true});
document.querySelector(".firstGalleryItem").dispatchEvent(startGalleryEvent);
})
Most helpful comment
Here is a snippet without using jquery in case anyone is looking for in the future: