默認情況下,指標水平的底部,分別對齊,垂直排列的指標,引導旋轉木馬
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
什麼是垂直對齊的各項指標最好的辦法,使各項指標總是均勻分佈在傳送帶內使用的圖像的高度,每個指示符的空間相等?我注意到編號爲carousel-example-generic
的元素的高度根據傳送帶內使用的圖像而變化,這是由於css屬性(可能是默認值)height: auto;
。
是否應使用式,看起來像:元件的
高度與指標carousel-example-generic
/量=指示器的高度的一個id?
我應該使用JavaScript來實現我在這裏要求的嗎?
我想要達到這樣的效果JSFiddle,但我不想爲我的指標使用固定高度的數字,我希望它們始終使用它們可以在旋轉木馬中使用的全部空間。
編輯:我的猜測是,指標的高度應該用我在以下JSFiddle中顯示的公式計算。
但現在的指標只有10個像素的高度。我希望他們儘可能高,他們可以在旋轉木馬內,同時在彼此的上方(或下方),同時適合旋轉木馬的高度(這僅在使用(例如佔位符)圖像之後可用)整體控制將是(在這個例子中)'2 * 10px + 1 * 12px = 32px',但是如果圖像高度高於32px?我仍然希望它們很好地適合。我希望你明白我在這裏要求的。 – Barrosy
你增加高度和寬度,不會影響圖像 –
不會增加指標的高度意味着當圖像的高度小於指標總高度乘以高度時它們將伸展超出傳送帶的底部,一旦旋轉木馬進入一個這樣的圖像? – Barrosy