G
G
Gadzhimari Kachaev2016-11-30 18:42:04
JavaScript
Gadzhimari Kachaev, 2016-11-30 18:42:04

How to enable/disable drag in OwlCarousel 2?

In general, when an event occurs, for example, a click on a button or something like that, I want the slide not to move anywhere when I try to swipe.

var owl = $('.owl-carousel');
owl.on('drag.owl.carousel', function() {
  owl.trigger('change.owl.carousel', {
    mouseDrag: false,
    touchDrag: false,
    pullDrag: false
  });
});

But in the trigger method, the following error occurs: "owl.carousel.min.js:6 Uncaught TypeError: Cannot read property 'name' of undefined(…)"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question