Skip to content

How to add description and title via the API #515

@tacman

Description

@tacman

How do I add a description (and title, etc.) via the API? The examples all appear to be data- attributes

        import 'https://cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js';

        var exampleApi = GLightbox({ selector: null });
        fetch('https://dummyjson.com/products')
            .then(response => response.json())
            .then(data => {
                data.products.forEach(product => {
                    product.images.forEach( i => {
                        exampleApi.insertSlide({
                            href: i,
                            // content: '<p>some html to append in the slide</p>',
                            // description: "A description"
                        });

                    })
                });
                exampleApi.open();

            })
            .catch(err => console.error(err))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions