Dynamically add images to photo paper

Is there a way to dynamically add images to the photoswipe gallery after creating it.

The situation is as follows.

I extract the URLs of the images from the section and display them in the gallery. As the elements load, anchor and img elements are added to the page. I would like to be able to add them to the photoswipe gallery at the same time.

currently in the element callback (after loading the image and adding the elements) I have

 $elements.photoSwipe({ enableMouseWheel: false , enableKeyboard: false });

This works, except that it creates each item in its own gallery. Is there a way to get a handle to an existing gallery and just add to it?

+5
source share
2 answers
if(this.photoSwipe == undefined){
   this.photoSwipe = $elements.photoSwipe(photoSwipeOptions);
}else{
    this.photoSwipe.append($elements);  //use jQuery append
}
+2
source

PhotoSwipe

Pull

// , .

0

All Articles