Как переключить класс на элемент Owl Carousel 2 drag? - PullRequest
0 голосов
/ 02 января 2019
//Once I drag the element I need it to do the same thing when the links are clicked.
    $('#resources').owlCarousel({
      items: 1,
      loop: false,
      center: true,
      margin: 0,
      URLhashListener: true,
      autoplayHoverPause: true,
      startPosition: 'URLHash',
      dots: false,
      0: {
          items: 1
      },
      600: {
          items: 1
      },
      1000: {
          items: 1
      }
    });

    //add active class on click
    $('#resource-hashes .container a').click(function() {
      $(this).toggleClass('active').siblings().removeClass('active');
    });

    //I need this to do the same thing as the above code when it is dragged
    $('#resource-hashes .container a').on('changed.owl.carousel', function(event) {
      $(this).toggleClass('active').siblings().removeClass('active');
    });
...