dbrekalo / simpleLightbox

SimpleLightbox is lightweight and responsive lightbox library with no dependencies. Display images, galleries, videos or custom content and control your lightbox with easy to use api.
http://dbrekalo.github.io/simpleLightbox/
MIT License
263 stars 76 forks source link

Can't display caption when open Lightbox by JS #20

Open efolam opened 4 years ago

efolam commented 4 years ago

How can I set caption to each image when I open Lightbox like this:

this.$lightbox.open({
  items: ['imageUrl1', 'imageUrl2', 'imageUrl3']
})

I tried do it so:

this.$lightbox.open({
  items: [
    {
      href: 'imageUrl1',
      title: 'caption 1'
    },
    {
      href: 'imageUrl2',
      title: 'caption 2'
    },
    {
      href: 'imageUrl3',
      title: 'caption 3'
    }
  ]
})

But it doesn't work

MrDanielPC commented 3 years ago

Hello, it's as easy as dividing them: this.$lightbox.open({ items: [imageUrl1,imageUrl2], captions: ['caption1', 'caption2'] ] })