0
我正在使用Bootstrap 3,並且我對滑塊有疑問:是否可以在只有文本正在更改/滑動的情況下保留相同的背景?如果是,那麼正確的代碼是什麼?Bootstrap滑塊:使用靜態背景更改文本
我正在使用Bootstrap 3,並且我對滑塊有疑問:是否可以在只有文本正在更改/滑動的情況下保留相同的背景?如果是,那麼正確的代碼是什麼?Bootstrap滑塊:使用靜態背景更改文本
使用從一對夫婦的調整引導文檔的例子:
得到一個靜態背景將設置在.carousel-inner
所需的背景的
<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"> /* set background on this element */
<div class="item active">
<div class="myplaceholder"></div> /* remove the <img> tags and replace with transparent div as a place holder */
<div class="carousel-caption">
<h3>This is the text that will scroll passed over a static background</h3>
</div>
</div>
的一種方式。然後用沒有背景顏色的div替換img>元素。
.carousel-inner { background: red; }
.myplaceholder { height: 400px; width: 400px; }
這將允許.carousel-caption
元素是可見的,似乎只是在滾動的頂部(在這種情況下)的靜態紅色背景。這是一個醜陋的黑客,所以如果你想讓它響應,你就不得不重新考慮它,但希望這會讓你走上正軌。
請不要使用「bootstrap」標籤,使用「twitter-bootstrap」標籤,因爲它意味着別的東西 – 2014-10-12 10:02:40