dimanche 21 août 2016

Magnific Popup, setting caption in javascript

Using magnific popup, is it possible to set captions for each image when initializing a gallery via javascript? There isn't a DOM element for each image, so it's not possible to use the title attribute (or any other attribute) as a pointer to the caption.

$('#my-gallery').magnificPopup({
    items: [
        {
            src: 'image.jpg',
            title: 'Some Title'
        },
        {
            src: 'image2.jpg',
            title: 'Some Other Title'
        }
    ],
    gallery: {
        enabled: true
    },
    type: 'image'
});

Aucun commentaire:

Enregistrer un commentaire