Adding images dynamically to photoswipe
javascript, photoswipe
Solution
if(this.photoSwipe == undefined){
this.photoSwipe = $elements.photoSwipe(photoSwipeOptions);
}else{
this.photoSwipe.append($elements); //use jQuery append
}
Problem
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?