我使用Bootstrap 3.3.7。我需要创建一个带有三个可见项目的垂直旋转木马。一个问题是,在导航按钮处单击时,旋转木马不会向上或向下移动1个项目。旋转木马不起作用。像这样的旋转木马http://jsfiddle.net/at606jpe/1079/只需要垂直。如何纠正给定的问题?
.carousel-inner.vertical {
height: 310px;
}
.carousel-inner.vertical > .item {
-webkit-transition: .6s ease-in-out top;
-o-transition: .6s ease-in-out top;
transition: .6s ease-in-out top;
}
@media all and (transform-3d),
(-webkit-transform-3d) {
.carousel-inner.vertical > .item {
-webkit-transition: -webkit-transform .6s ease-in-out;
-o-transition: -o-transform .6s ease-in-out;
transition: transform .6s ease-in-out;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000;
perspective: 1000;
}
.carousel-inner.vertical > .item.next,
.carousel-inner.vertical > .item.active.right {
top: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
.carousel-inner.vertical > .item.prev,
.carousel-inner.vertical > .item.active.left {
top: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
.carousel-inner.vertical > .item.next.left,
.carousel-inner.vertical > .item.prev.right,
.carousel-inner.vertical > .item.active {
top: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.carousel-inner.vertical > .active {
top: 0;
}
.carousel-inner.vertical > .next,
.carousel-inner.vertical > .prev {
top: 0;
height: 100%;
width: auto;
}
.carousel-inner.vertical > .next {
left: 0;
top: 100%;
}
.carousel-inner.vertical > .prev {
left: 0;
top: -100%
}
.carousel-inner.vertical > .next.left,
.carousel-inner.vertical > .prev.right {
top: 0;
}
.carousel-inner.vertical > .active.left {
left: 0;
top: -100%;
}
.carousel-inner.vertical > .active.right {
left: 0;
top: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" type="text/css" media="screen" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="carousel-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Wrapper for slides -->
<div class="carousel-inner vertical" role="listbox">
<div class="item active">
<img src="http://placehold.it/75x120&text=First" alt="First Slide">
</div>
<div class="item">
<img src="http://placehold.it/75x120&text=Second" alt="Second Slide">
</div>
<div class="item">
<img src="http://placehold.it/75x120&text=Third" alt="Third Slide">
</di>
<div class="item">
<img src="http://placehold.it/75x120&text=Fourth" alt="Fourth Slide">
</div>
<div class="item">
<img src="http://placehold.it/75x120&text=Fifth" alt="Fifth Slide">
</div>
<div class="item">
<img src="http://placehold.it/75x120&text=Sixth" alt="Sixth Slide">
</div>
<div class="item">
<img src="http://placehold.it/75x120&text=Seventh" alt="Seventh Slide">
</div>
</div>
<div href="#carousel-generic" class="scroll-up" data-slide="prev"><i class="glyphicon glyphicon-chevron-up"></i></div>
<div href="#carousel-generic" class="scroll-down" data-slide="next"><i class="glyphicon glyphicon-chevron-down"></i></div>
</div>