问题描述
我正在尝试修改新的 Bootstrap 4 Beta Carousel 以使用淡入淡出而不是滑动操作从幻灯片过渡到幻灯片,并使用 CSS.我无法让它工作.我不确定是否需要特殊的 Javascript 调用.
请在此处查看 Codepen:
.carousel-fade .carousel-inner .item {-webkit-transition-property:不透明度;过渡属性:不透明度;}.carousel-fade .carousel-inner .item,.carousel-fade .carousel-inner .active.left,.carousel-fade .carousel-inner .active.right {不透明度:0;}.carousel-fade .carousel-inner .active,.carousel-fade .carousel-inner .next.left,.carousel-fade .carousel-inner .prev.right {不透明度:1;}.carousel-fade .carousel-inner .next,.carousel-fade .carousel-inner .prev,.carousel-fade .carousel-inner .active.left,.carousel-fade .carousel-inner .active.right {左:0;-webkit-transform: translate3d(0, 0, 0);变换:translate3d(0, 0, 0);}.carousel-fade .carousel-control {z-索引:2;}html,身体,.旋转木马,.carousel-内,.carousel-inner .item {高度:100%;}
<div id="carousel" class="carousel slide carousel-fade" data-ride="carousel"><div class="carousel-inner" role="listbox"><div class="carousel-item active"><img class="d-block img-fluid" src="https://tuniverse.io/wp-content/uploads/2016/12/boss-tu-2-06.jpg" alt="第一张幻灯片"><div class="carousel-item"><img class="d-block img-fluid" src="https://tuniverse.io/wp-content/uploads/2016/12/boss-tu-2-08.jpg" alt="第二张幻灯片">
<div class="carousel-item"><img class="d-block img-fluid" src="https://tuniverse.io/wp-content/uploads/2016/12/boss-tu-2-09.jpg" alt="第三张幻灯片">