Search code examples
javascriptjqueryflexslider

how to stop swipe , If only one image in flexslider


Is there any way to stop swipe functionality with flexslider. If inserted image is only one. like :

   $('.flexslider').flexslider({
      touch: $('.flexslider li').length > 1
   });

Solution

  • I Got the solution:

    if ($('#flexslider').length > 0) {
        var Len = $('#flexslider li').length;
        var Len;
        if(Len >1){
            swipe = true;
        }
        else{
           swipe = false;   
        }
        $('#flexslider').flexslider({
            animation: "slide",
            controlNav: false,
            touch:swipe,
            after: function(slide) {
                //console.log(slider....);
            }
    
        });
    }