• Hi,

    this is my website fidastav.konekto.net and I have problem with Fotogaleria site so I created test page

    https://monika.konekto.net/gallery.html

    I want to make click-through gallery with light-box. Click-through gallery works perfectly but i have big problem with light-box. I do not know harmonize it. In HTML – gallery thumbnail images I put first after than I put light-box section with images.

    There is jquery:

    /**
     *GALLERY
     */
    
    $(function(){
    
    // najdeme v?etky galérie
    
    var galleries = $('.gallery-set');
    
    //skryjeme galérie
    
    galleries.hide();
    
    var selected = $('.controls').find('.selected');
    
    //funckia na zobrazenie selektnutej galerie
    function showGallery (selected) {
          if(selected.length) {
          var id = selected.find('a').attr('href');
          selectedGallery = $(id);
          }
    
          var newGallery = selectedGallery.length ? selectedGallery : galleries.eq(0).show();
    
          galleries.not( newGallery ).hide();
    
          newGallery.fadeIn();
    
           }
    
    showGallery( selected );
    
    $('.controls a').on('click', function() {
          var li = $(this).parent();
    
          li.addClass('selected').
          siblings().removeClass('selected'); 
    
    showGallery( li );
    event.preventDefault();
    });
    
    });
    
    /**
     * SLIDER
     */
    
    $(function () {
        var currentIndex = 0,
            lightboxLis = $('.light-box li');
    
    var overlay = $('<div/>', {id: 'overlay'});
    overlay.appendTo('body').hide();
    
        $('.thumbnail li').click(function () {
    overlay.show();
            currentIndex = $(this).index();
    
            lightboxLis.eq(currentIndex).show();
    
            //put next prev show here otherwise it won't work due to your hover
            //when you hover the next prev button in your old version you no longer hover the li so can't click on the button
    
            $('.next, .prev, .close').show();
            //add the hide of next prev to when you close the lightbox
        });
    
        $('.next').click(function() {
            currentIndex++;
            if (currentIndex == lightboxLis.length) {
                currentIndex = 0;
            }
    
            lightboxLis.hide();
            lightboxLis.eq(currentIndex).show();
        });
    
        $('.prev').click(function() {
            currentIndex--;
            if (currentIndex < 0) {
                currentIndex = lightboxLis.length - 1;
            }
    
            lightboxLis.hide();
            lightboxLis.eq(currentIndex).show();
          });
    
    $('.close, #overlay').on("click", function() {
    $('.close').hide();
    overlay.hide();
    $('.next, .prev').hide();
    lightboxLis.eq(currentIndex).toggle();
    });
    
    });

    When i click on sanita gallery and then on image, appears first image of maliarske a murarske práce. I need show light-box images only for sanita…
    Really I don′t know how to fix it. I′m a beginner in custom theme and in jquery. If there is any similar click-trough gallery plugin with light-box I will appreciate it. Thanks a lot

  • The topic ‘Click-through gallery with light-box’ is closed to new replies.