Is there a way to add images dynamically to a photoswipe gallery after it is created.
The situation is this.
I'm fetching image urls from the sever and showing them in a gallery. As the items are downloaded the anchor and img elements are added to the page. I would like to be able to at that same time append each to the photoswipe gallery.
currently in the element callback (after the image has been loaded and elements appended) I have
$elements.photoSwipe({ enableMouseWheel: false , enableKeyboard: false });
This works except it creates each element in it's own gallery. Is there a way to get a handle to an existing gallery and just append to it?
if(this.photoSwipe == undefined){
this.photoSwipe = $elements.photoSwipe(photoSwipeOptions);
}else{
this.photoSwipe.append($elements); //use jQuery append
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With