gpt4 book ai didi

twitter-bootstrap - Bootstrap 中的轮播动画效果

转载 作者:行者123 更新时间:2023-12-04 07:50:17 24 4
gpt4 key购买 nike

除了幻灯片之外,我们是否可以在 Bootstrap 轮播中添加任何其他默认动画。在 <div id="myCarousel" class="carousel slide" data-ride="carousel">我不想要滑动效果有没有其他的效果我们可以添加而不用写任何额外的代码或者动画效果。

最佳答案

我们可以使用淡入淡出效果而不是滑动效果,试试这个:

CSS:

.carousel-fade .carousel-inner .item {
opacity: 0;
-webkit-transition-property: opacity;
-moz-transition-property: opacity;
-o-transition-property: opacity;
transition-property: opacity;
}
.carousel-fade .carousel-inner .active {
opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
left: 0;
opacity: 0;
z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
opacity: 1;
}
.carousel-fade .carousel-control {
z-index: 2;
}

HTML:

<div id="Carousel" class="carousel slide carousel-fade col-lg-8 col-offset-2">
<ol class="carousel-indicators">
<li data-target="Carousel" data-slide-to="0" class="active"></li>
<li data-target="Carousel" data-slide-to="1"></li>
<li data-target="Carousel" data-slide-to="2"></li>
</ol>

<div class="carousel-inner">
<div class="item active">
<img src="//placehold.it/1300x500" class="img-responsive">
</div>
<div class="item">
<img src="//placehold.it/1300x500/55EE55" class="img-responsive">
</div>
<div class="item">
<img src="//placehold.it/1300x500/CCFEFE" class="img-responsive">
</div>
</div>

<a class="left carousel-control" href="#Carousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#Carousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>

查看这些:Example1Example2

关于twitter-bootstrap - Bootstrap 中的轮播动画效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42312052/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com