mujtaba01 / ngx-owl-carousel

An angular2 (4) wrapper for jquery owl-carousel library with dynamic carousel item change detection
MIT License
70 stars 25 forks source link

owlElement.trigger('stop.owl.autoplay') doesn't stop the auoplay #17

Closed edmondko closed 7 years ago

edmondko commented 7 years ago

I'm trying to stop autoplay on Drag event, but it doesnt seem to work. I've tried to trigger the event but it doesn't work at all. I got to do this but it's not best solution:

carouselOptions = {
      items: 1,
      dotsContainer: '.owl-dots',
      navigation: false,
      loop: true,
      lazyLoad: false,
      autoplay: true,
      autoplayTimeout: 5000,
      onDrag: this.onDrag
  };
  onDrag(event) {
    event.relatedTarget.settings.autoplay = false;
  }

This code seems to work, on event but it plays another slide and then stops the autoplay.

lexcaraig commented 7 years ago

have you tried using this.onDrag.bind(this) ?

edmondko commented 7 years ago

I actually did that and it worked, thanks for confirmation I'll close this ticket