I was wondering if anyone knew of a bootstrap carousel example where the image does not scroll/change, just the text.
I'd like a static image, but scrolling text appearing from the right hand side and disappearing to the left.
I was wondering if anyone knew of a bootstrap carousel example where the image does not scroll/change, just the text.
I'd like a static image, but scrolling text appearing from the right hand side and disappearing to the left.
Just don't add an image to each .item
and instead apply an image to the .carousel
object. Since normally the image provides some sort of height to the item, you might want to apply your own height so it looks consistent.
.carousel.slide {
background: url('http://lorempixel.com/400/300/cats/1/');
}
.item {
height: 200px;
}
<!-- language: lang-html -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"></script>
<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">
<div class="carousel-caption">
Text 1
</div>
</div>
<div class="item">
<div class="carousel-caption">
Text 2
</div>
</div>
<div class="item">
<div class="carousel-caption">
Text 3
</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>
<!-- end snippet -->