Disable swipe-functionality on flexslider IF only one image?

Hi, I am using flexslider on a website, were the client can add images to several sliders on the page. However, if a slider only contains one li or image, how can I disable the swipe functionality? On desktop it works fine it just disables the control and direction -navs , and it does so on mobile devices aswell but I can still swipe through images.

Anyone know?

Can I set some conditions like if only 1 <li> touch: false?

Something like this:

      after: function(slider) {
          if('<li>' < 1){
              slider.touch = false;
              slider.touch = true;


It took me about two seconds to look at the documentation and find a option for doing what you desire.

There is a boolean option touch that be set to false to disable touch swiping. The only additional part is detecting the mobile device itself.

c’mon step up your game.

And you think it is this easy? it is not. First of, disabling touch with touch: false; disables touch for all sliders, and this is not only swiping, this disables vertical scrolling and tapping aswell, and since several of the images work as links that is not very good. Also as I said in the topic (maybe I was a bit unclear my english aint the best) I only want to disable swiping if the slider has <= 1 images.

I tried some if/else conditions, (not the same as above) but it didn’t really work. Don’t have the code on this computer so cannot show it right now tho.

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

The correct syntax would be something like that for the example on flexslider website.

THanks will try it out=)


Still struggling with this problem.

As i am a jquery noob can someone check this and see what is wrong?

$(window).load(function() {
      slideshow: true,
      if($('.flexslider li').length > 1) {
        touch: false
      } else {
        touch: true

What I want to do I guess is pretty obvious if u check my script=) I want to disable touch/swipe if the slider only has one <li>, and enable if it has more.