I'm trying to add swipe config in bootstrap 4 carousel (ngb-carousel). But it seems it's not implemented yet. So is there any alternate way to achieve the swipe in bootstrap 4 carousel?
I'm trying to add swipe config in bootstrap 4 carousel (ngb-carousel). But it seems it's not implemented yet. So is there any alternate way to achieve the swipe in bootstrap 4 carousel?
1-import ngb carousel to your ts file:
import { NgbCarousel } from '@ng-bootstrap/ng-bootstrap';
2-Add ViewChild Section to ts file:
@ViewChild(NgbCarousel) carousel;
3-Add swiper method to ts file:
swipe(e) {
if (e === 'swiperight') {
this.carousel.prev();
} else {
this.carousel.next();
}
}
4- Add events carousel main div to html file:
<div class="swipe" id="carousel"(swipeleft)="swipe($event.type)"
(swiperight)="swipe($event.type)">