2014-10-08 22 views
0

我正在使用Bootstrap 3,并且我对滑块有疑问:是否可以在只有文本正在更改/滑动的情况下保留相同的背​​景?如果是,那么正确的代码是什么?Bootstrap滑块:使用静态背景更改文本

+0

请不要使用“bootstrap”标签,使用“twitter-bootstrap”标签,因为它意味着别的东西 – 2014-10-12 10:02:40

回答

0

使用从一对夫妇的调整引导文档的例子:

得到一个静态背景将设置在 .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元素是可见的,似乎只是在滚动的顶部(在这种情况下)的静态红色背景。这是一个丑陋的黑客,所以如果你想让它响应,你就不得不重新考虑它,但希望这会让你走上正轨。