I'm in the process of building a carousel. I have set up the structure, but I only want five blocks to be visible initially, with the sixth block appearing after clicking an arrow. How can I achieve this?
My strategy: (adopted from here)
img{
border: 1px solid red;
width: 100px;
height: 100px;
display: block;
}
ul{
display: inline-block;
}
li{
list-style-type: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<!----------->
<!-- CTA 1 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 1</span>
</li>
</ul>
<!----------->
<!-- CTA 2 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 2</span>
</li>
</ul>
<!----------->
<!-- CTA 3 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 3</span>
</li>
</ul>
<!----------->
<!-- CTA 4 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 4</span>
</li>
</ul>
<!----------->
<!-- CTA 5 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 5</span>
</li>
</ul>
<!----------->
<!----------->
<!-- TO APPEAR AFTER CONTROL CLICK -->
<!----------->
<!-- CTA 6 -->
<!----------->
<ul class="clearfix">
<li>
<img src=""/>
<span>Test 6</span>
</li>
</ul>
</div>
</div>
<!--=====================-->
<!--== ON ARROW DISPLAY -==>
<!--=====================-->
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
Presently, all six blocks are being displayed at once. I am unsure of the differences between the provided demo and my implementation (aside from the structural elements).