Include DOM gallery builder in JS file
Please include the initPhotoSwipeFromDOM function shown in http://photoswipe.com/documentation/getting-started.html#dom-to-slide-objects in PhotoSwipe in a JS file. That would make it much easier to get started with a gallery.
Jimmy Merrild Krag commented
I have made an improved version of the function that takes a default options argument. You can find it at https://pastebin.com/xJTE05sS