Search code examples
javascriptjquerysliderbxslider

BxSlider—Click Slide for Next


Instead of using prev/next controls, I'd like to turn the slide itself into a next button. Pretty straightforward functionality, but I can't seem to figure it out.

This is what I have:

$(document).ready(function() {
  $('.bxslider').bxSlider({
    adaptiveHeight: true,
    easing: 'cubic-bezier(0.600, 0.060, 0.500, 1)'
  });
  $('.bxslider').click(function() {
    slider.goToNextSlide();
    return false;
  });
});

Solution

  • Firstly, create an instance of the slider like this

    var slider = $('.bxslider').... and then attach the onClick to the same input.

    Something like this should work.

    var slider = $('.bxslider').bxSlider({
        adaptiveHeight: true,
        easing: 'cubic-bezier(0.600, 0.060, 0.500, 1)'
    }).on('click', function(){
        slider.goToNextSlide();
    });