Search code examples
jquerygalleria

galleria.io Lightbox disable next button in Last Image


I would like to disable/hide next button in lightbox. We are using galleria.io image gallery. Please help. JS Fiddle: http://jsfiddle.net/sudiptabanerjee/m6x23/

JavaScript

// Initialize Galleria
$(document).ready(function () {
if (document.getElementById('galleria')) {
Galleria.run('#galleria', {
        transition: 'fadeslide',
        imageCrop: false,
        lightbox: true,
        wait: true,
        height:350,
        debug:false
});
}
});  

Please help.


Solution

  • It is working now http://jsfiddle.net/sudiptabanerjee/m6x23/7/

    Galleria.ready(function () {
    Galleria.on('image', function (e) {
        if (this._active == this._data.length - 1) {
            $('.galleria-image-nav-right').hide();
        } else {
            $('.galleria-image-nav-right').show();
        }
        if (this._active == 0) {
            $('.galleria-image-nav-left').hide();
        } else {
            $('.galleria-image-nav-left').show();
        }
    });
    
    Galleria.on('lightbox_image', function (e) {
        if (this._lightbox.active == this._data.length - 1) {
            $('.galleria-lightbox-next').hide();
            $('.galleria-lightbox-nextholder').hide();
        } else {
            $('.galleria-lightbox-next').show();
            $('.galleria-lightbox-nextholder').show();
        }
        if (this._lightbox.active == 0) {
            $('.galleria-lightbox-prev').hide();
            $('.galleria-lightbox-prevholder').hide();
        } else {
            $('.galleria-lightbox-prev').show();
            $('.galleria-lightbox-prevholder').show();
        }
    });
    
    });