2017-06-05 112 views
0

我想將傳送帶的​​方向從左到右更改爲從頂到底。我發現的所有答案都是Bootstrap 3的答案,並且它們不起作用。我如何在Bootstrap 4中執行此操作?Change Bootstrap 4傳送帶方向

這裏的旋轉木馬代碼:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"> 
 
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> 
 

 

 
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> 
 
    <ol class="carousel-indicators"> 
 
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> 
 
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> 
 
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> 
 
    </ol> 
 
    <div class="carousel-inner" role="listbox"> 
 
    <div class="carousel-item active"> 
 
     <img class="d-block img-fluid" src="http://via.placeholder.com/350x150" alt="First slide"> 
 
    </div> 
 
    <div class="carousel-item"> 
 
     <img class="d-block img-fluid" src="http://via.placeholder.com/350x150" alt="Second slide"> 
 
    </div> 
 
    <div class="carousel-item"> 
 
     <img class="d-block img-fluid" src="http://via.placeholder.com/350x150" alt="Third slide"> 
 
    </div> 
 
    </div> 
 
    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> 
 
    <span class="carousel-control-prev-icon" aria-hidden="true"></span> 
 
    <span class="sr-only">Previous</span> 
 
    </a> 
 
    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> 
 
    <span class="carousel-control-next-icon" aria-hidden="true"></span> 
 
    <span class="sr-only">Next</span> 
 
    </a> 
 
</div>

+0

你到目前爲止試過了什麼? –

回答

0

你需要覆蓋默認的方向,就在你的CSS文件中添加以下的樣式,並確保你的CSS文件加載引導文件後:

.carousel-item-next.carousel-item-left, 
.carousel-item-prev.carousel-item-right { 
-webkit-transform: translate3d(0, 0, 0); 
     transform: translate3d(0, 0, 0); 
} 
.carousel-item-next, 
.active.carousel-item-right { 
    -webkit-transform: translate3d(0, -100%, 0); 
     transform: translate3d(0, -100%, 0); 
} 
.carousel-item-prev, 
.active.carousel-item-left { 
-webkit-transform: translate3d(0, +100%, 0); 
     transform: translate3d(0, +100, 0); 
} 

我爲你做了一個例子:

https://jsfiddle.net/emilvr/L6cm19hL/2/