Angular 缺少引导4转盘滑动配置
我正在尝试在引导4旋转木马(ngb旋转木马)中添加滑动配置。但它似乎还没有实施。那么,在bootstrap 4 carousel中是否有其他方法可以实现滑动呢?我也遇到了同样的问题,我发现了一个名为jQuery的简单插件,它允许您这样做。您只需下载插件并在头脑中链接到它,然后将以下代码添加到html文件的底部:Angular 缺少引导4转盘滑动配置,angular,carousel,bootstrap-4,Angular,Carousel,Bootstrap 4,我正在尝试在引导4旋转木马(ngb旋转木马)中添加滑动配置。但它似乎还没有实施。那么,在bootstrap 4 carousel中是否有其他方法可以实现滑动呢?我也遇到了同样的问题,我发现了一个名为jQuery的简单插件,它允许您这样做。您只需下载插件并在头脑中链接到它,然后将以下代码添加到html文件的底部: <script> $(document).ready(function() { //Enable swiping... $(".carousel-inne
<script>
$(document).ready(function() {
//Enable swiping...
$(".carousel-inner").swipe( {
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) {
$(this).parent().carousel('prev');
},
swipeRight: function() {
$(this).parent().carousel('next');
},
//Default is 75px, set to 0 for demo so any distance triggers swipe
threshold:0
});
});
</script>
<div class="swipe" id="carousel"(swipeleft)="swipe($event.type)"
(swiperight)="swipe($event.type)">
$(文档).ready(函数(){
//启用刷卡。。。
$(“.carousel-inner”)。刷卡({
//适用于所有方向的通用滑动处理程序
swipeLeft:功能(事件、方向、距离、持续时间、手指计数){
$(this.parent().carousel('prev');
},
swipeRight:function(){
$(this.parent().carousel('next');
},
//默认值为75px,演示设置为0,因此任何距离都会触发滑动
阈值:0
});
});
1-将ngb转盘导入ts文件:
import { NgbCarousel } from '@ng-bootstrap/ng-bootstrap';
2-将ViewChild节添加到ts文件:
@ViewChild(NgbCarousel) carousel;
swipe(e) {
if (e === 'swiperight') {
this.carousel.prev();
} else {
this.carousel.next();
}
}
3-将swiper方法添加到ts文件:
@ViewChild(NgbCarousel) carousel;
swipe(e) {
if (e === 'swiperight') {
this.carousel.prev();
} else {
this.carousel.next();
}
}
4-将事件转盘主div添加到html文件:
<script>
$(document).ready(function() {
//Enable swiping...
$(".carousel-inner").swipe( {
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) {
$(this).parent().carousel('prev');
},
swipeRight: function() {
$(this).parent().carousel('next');
},
//Default is 75px, set to 0 for demo so any distance triggers swipe
threshold:0
});
});
</script>
<div class="swipe" id="carousel"(swipeleft)="swipe($event.type)"
(swiperight)="swipe($event.type)">
您是否找到了通过刷卡触发旋转木马的选项?