• Resolved netpack

    (@netpack)


    How to open a Visual Portfolio gallery lightbox by clicking any button?

    I’m using (DIVI and) Simple Gallery, but i’d like to change this to Visual Portfolio gallery.
    I used this function with Simple Gallery with the code below:

    jQuery(document).ready(function(){
    jQuery(‘.pa-gallery-trigger’).click(function(){
    jQuery(‘.pa-gallery .et_pb_gallery_item:nth-child(1) img’).click();
    });
    });

    ..the button class is: pa-gallery-trigger
    ..the gallery class is: pa-gallery

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Alex

    (@fellan91)

    Hello,

    I don’t understand the purpose of this question. Since you already have a visual portfolio gallery on the page, you can open any gallery element using this code: $('.vp-portfolio__item .vp-portfolio__item-img > a').click();

    This works the same way as clicking a portfolio gallery item.

    Regards,
    Alex

    • This reply was modified 3 months, 2 weeks ago by Alex.
    Thread Starter netpack

    (@netpack)

    Hello Alex,
    example:
    I have 1 button (button1) and 1 gallerie (gallery1)
    I want to open gallery1 by clicking button1.

    I made this with “simple gallery” with the next way:
    ..the button1 class is: gallery1-trigger
    ..the gallery1 class is: gallery1
    …the script:
    jQuery(document).ready(function(){
    jQuery(‘.gallery1-trigger’).click(function(){
    jQuery(‘.gallery1 .et_pb_gallery_item:nth-child(1) img’).click();
    });
    });

    It works well with “Simple gallery” pugin, but I don’t know what element to use instead of this, if i use visual portfolio plugin: “.et_pb_gallery_item:nth-child(1) img’).click();”

    Plugin Author Nikita

    (@nko)

    Hi @netpack,

    Alex provided a working jQuery snippet that clicks the first gallery item. You can add a custom class to your gallery and modify the snippet to target only the first item in your specific gallery. Example:

    $('.gallery-1 .vp-portfolio__item-wrap:first-child .vp-portfolio__item-img > a').click();

    Regards,
    Nikita.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.