Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to attach event/callback? #55

Open
Mukeysh opened this issue Aug 6, 2018 · 3 comments
Open

how to attach event/callback? #55

Mukeysh opened this issue Aug 6, 2018 · 3 comments

Comments

@Mukeysh
Copy link

Mukeysh commented Aug 6, 2018

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.

@dgbarbosa
Copy link

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

@Mukeysh
Copy link
Author

Mukeysh commented Aug 22, 2018

@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) {

}

@rkpip3
Copy link

rkpip3 commented Oct 22, 2020

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);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants