Okay
  Public Ticket #2262323
Add Lightbox in post
Closed

Comments

  • bh8489 started the conversation

    Hi Laborator, I hope you're well.

    I have a link in a plain box of html/text on a page that I'd like to have open in a Lightbox. (It happens to be a youtube video in this case.) How can I manually have it load in a Lightbox, and can you share which jQuery Lightbox plugin you use so I can reference their documentation in case I want to further customize this or other lightboxes?

    I'm looking to, for example, just add a class like "lightbox" to the link in my page's html that opens it in a Lightbox.

    Thanks!

  • [deleted] replied

    Hi,

    I understand the point, our lightbox API is simple, if you want to open an image in lightbox this is the code to execute:

    Kalium.Media.lightbox( {
        options: {
            lightGalleryOptions: {
                counter: false,
            }
        },
        items: [
            new Kalium.Media.Lightbox_Item( 'url/for/image.jpg', { caption: 'Hello World' } ),
        ],
    } );
    

    If you want to open YouTube video then the first parameter for Lightbox_Item should be YouTube video URL:

    Kalium.Media.lightbox( {
        options: {
            lightGalleryOptions: {
                counter: false,
            }
        },
        items: [
            new Kalium.Media.Lightbox_Item( 'https://www.youtube.com/watch?v=oBjyd3M02hM', { caption: 'Hello World' } ),
        ],
    } );
    

    Here is a test of this code I have recorded for you:

    https://d.pr/v/qluS7f

    I hope this will work fine for you