14

Hey all I have a quick question regarding the Owl Carousel.

How can I enable the touchdrag when I first use this code:

var owl = $(".full-slider");

owl.owlCarousel({
        slideSpeed              : 500,
        singleItem              : true,
        pagination              : false,
        autoPlay                : false,
        afterMove               : slideChanged,
        startDragging           : pauseOnDragging,
        touchDrag               : false,
        mouseDrag               : false
});

Depending on the options the user uses on my page, I want to disable the ability to drag to the next slide. But if the user completes the options then I would like to enable it back so they can drag to the next slide.

How can this be done? I haven't been able to find a good example online for doing this.

1 Answer 1

39

I found out how to do it finally:

 owl.data('owlCarousel').reinit({
     touchDrag  : true,
     mouseDrag  : true
 });
2
  • 2
    Code works. I found that reinit() will reset the slider to the first slide.
    – Pim Schaaf
    Commented Feb 19, 2015 at 15:47
  • i should be capital in reinit. It should be reInit() Commented Nov 22, 2019 at 10:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.