Okay
  Public Ticket #3370034
Lightbox
Closed

Comments

  •  1
    Achim started the conversation

    Hello, how can I use the lightbox used for Portfolio for normal posts?

    Is it possible?


    Thanks

    Achim

  •  1,558
    Laborator replied

    Hi Achim,

    Unfortunately it is not possible to use the portfolio gallery in the blog as they are two different libraries.

    Best regards,
    Laborator Team


      Documentation         Join Kalium Users Group

  •  1
    Achim replied

    Hi Art,

    I got it to work.

    --------------------------------------

    Insert in function,php of child-theme:

    /* add js file*/
    function js_code_page() {
    if (is_page ('your-page ID-')) { ?>
    <link to existing lightgallery-all.min.js>
    <link to custom.js file to initalize gallery>
    <?php
    }
    }
    add_action('wp_head', 'js_code_page');

    /* add css file*/
    function css_code_page() {
    if (is_page ('your-page.ID')) { ?>
    <link to existing lightgallery.min.css>
    <link to lg-transitions.min.css>
    <?php
    }
    }
    add_action('wp_head', 'css_code_page');

    ------------------------------------

    and in custom.js file:

    jQuery( document ).ready(function ($) {
      $('.wp-block-gallery').lightGallery({
          selector: '.wp-block-image a',
          speed     : 1000,      // Transition duration (in ms).
          preload         : 3,    //number of preload slides.  

           thumbnail            : true,     // Whether to display a button to show thumbnails.
          showThumbByDefault   : false,    // Whether to display thumbnails by default.
          animateThumb         : true,     // Enable thumbnail animation.
          currentPagerPosition : 'middle', // Position of selected thumbnail.
          controls         : true,  // Whether to display prev/next buttons.
          hideControlOnEnd : true, // If true, prev/next button will be hidden on first/last image.
          loop             : false, // Allows to go to the other end of the gallery at first/last img.
          auto             : false, // Enables slideshow mode.
          pause            : 4000,  // Delay (in ms) between transitions in slideshow mode.
          download         : true,
          rotate            :false,
          share             :false,
          zoom              :false,
          scale             :false,
          autoplayControls  :false,
          escKey           : true,  // Whether lightGallery should be closed when user presses "Esc".
          closable         : false,  //allows clicks on dimmer to close gallery
          counter          : true, // Shows total number of images and index number of current image.
          slideEndAnimatoin : false,
          mode: 'lg-fade',
          height: '100%',
          hideBarsDelay:0

        });
    $('.ac-gallery.wp-block-gallery a').each(function() {
        var ahref = $(this).attr("href");
        $(this).find('img').attr("srcset", ahref);
    });   });

    ---------------------------------------------

    The images of wp-gallery must be linked to mediafile.
    I,ll try to make it more responsive. Hmm...

  •  1,558
    Laborator replied

    Hi there,

    Happy to hear that you have found a way to implement that in your site and thank you for sharing the snippet code for users who want to implement the same idea as yours because it is not possible in the theme options.

    Best regards,
    Laborator Team


      Documentation         Join Kalium Users Group