ngx-owl-carousel icon indicating copy to clipboard operation
ngx-owl-carousel copied to clipboard

how to attach event/callback?

Open Mukeysh opened this issue 7 years ago • 3 comments

I just want to know how to attach an event with the carousel. E.g: I want to attach onDragged callback with the carousel. Any help would be appreciated.

Mukeysh avatar Aug 06 '18 15:08 Mukeysh

@Mukeysh any news? I'm having the same question here

dgbarbosa avatar Aug 21 '18 17:08 dgbarbosa

@dgbarbosa I have done this following: .html <owl-carousel [options]='{items: 1, dots: false, navigation: false, stagePadding: 30, margin:10, onDrag: this.owlDrag.bind(this)}' [items]="images" [carouselClasses]="['owl-theme', 'owl-package','sliding']"> <div class="item" *ngFor="let slide of slides">

{{slide.text}}

.ts file owlDrag(event) {

}

Mukeysh avatar Aug 22 '18 09:08 Mukeysh

add this in options:

    mouseDrag: true,
    touchDrag: true,
    pullDrag: true,

add "(dragging)="startDragging($event.dragging)" <owl-carousel-o [options]="customOptions" #owlElement (dragging)="startDragging($event.dragging)">

  startDragging(event){
    console.log(event);
  }

rkpip3 avatar Oct 22 '20 07:10 rkpip3