Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show the next slide when you click on the image in flexslider

I'm using the flexslider plugin and i wanted to know if there is an easy way (apart from changing the core of the plugin which is what i am going to do if i don't find an easy answer) to show the next slide when you click on the current slide. I set up the flexslider like this

$('.flexslider').flexslider({
    directionNav : false,
    slideshow: false,
        animation: "slide",
        controlsContainer: ".flex-container"
    });

I disabled the Prev/Next command because i didn't like them. What should i do?

like image 703
Nicola Peluchetti Avatar asked Mar 05 '12 16:03

Nicola Peluchetti


Video Answer


2 Answers

Maybe a little bit too late, but here's the solution for Flexslider 2:

$('.flexslider').flexslider({
    directionNav : false,
    slideshow: false,
    animation: "slide",
    controlsContainer: ".flex-container",
    start: function(slider) {
    $('.slides li img').click(function(event){
        event.preventDefault();
        slider.flexAnimate(slider.getTarget("next"));
    });
}
});
like image 174
Sergey Avatar answered Sep 28 '22 05:09

Sergey


I had a Safari problem with the code above. This is my easy solution.

jQuery( document ).ready( function( $ ) {
    $('.flexslider').on('click', function(){
        $(this).find('.flex-next').click();
    });  
}


$(window).load(function() { 
    // Slider
    $('.flexslider').flexslider({
    directionNav : false,
    slideshow: false,
    animation: "slide",
    controlsContainer: ".flex-container"    
    });
});
like image 30
meck373 Avatar answered Sep 28 '22 05:09

meck373