0

I'm using the jQuery Unslider plugin for a simple photo gallery, and it seems to be working well except that there doesn't seem to be an option to go to the next image by clicking on the current one.

I tried to implement that option myself with the following code, but it only works the first time I click:

var Gallery = $('#PageGallery');
var unslider = Gallery.unslider({
    animateHeight: true,
    arrows: false,
    infinite: true, 
    nav: false
});

$('.unslider-active').each(function() {
    $(this).click(function() {
        unslider.unslider('next');
    });
});

I'd appreciate any help, thanks!

Bankitalia
  • 21
  • 4

1 Answers1

0

Okay, I found a solution myself. It's enough to bind the click event to all elements of the slider, not just the active one, like this:

$('#PageGallery li').click(function() {
    unslider.data('unslider').next();
});

Hope this helps someone else!

Bankitalia
  • 21
  • 4