2

I'm new to PhotoSwipe, getting very confused about how to add an external link to image

this is the .js file I used to load images, however, it only has url and caption,

instance = PhotoSwipe.attach(
[
    { url: 'img/picture1.jpg', caption: 'Image 001'},
    { url: 'img/picture2.jpg', caption: 'Image 002'},
    { url: 'img/picture3.jpg', caption: 'Image 003'},
    { url: 'img/picture4.jpg', caption: 'Image 004'},
    { url: 'img/picture5.jpg', caption: 'Image 005'},
],
{
    target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
    preventHide: true,
    getImageSource: function(obj){
        return obj.url;
    },
    getImageCaption: function(obj){
        return obj.caption;
    }
}
);

other than doing this in html with

<ul id="Gallery">
<li><a href="images/full/01.jpg"><img src="images/thumb/01.jpg" alt="Image 01"      /></a></li>

</ul>

is there any other way to add a parameter within PhotoSwipe.attach to hyperlink the image with external link?

Jeff
  • 12,555
  • 5
  • 33
  • 60

0 Answers0