user2953989
user2953989

Reputation: 2979

Twitter Bootstrap full screen carousel

I want to make a full screen image carousel for my webpage, I managed to get it working fine until I added more than one image. Now the images are below each other and the sample text is only on the last image. Here's my code, hope you can help. Thanks.

<!---CAROSUEL---->
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
    <li data-target="myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="myCarousel" data-slide-to="1"></li>
    <li data-target="myCarousel" data-slide-to="2"></li>    
</ol>
<div class="carousel-inner"></div>
    <div class="item active"><img src="img/bg.jpg" style="height: 100%; width: 100%; display: block;">
        <div class="container">
            <div class="carousel-caption">
            <h1>Sara Cook</h1>
            <p>This tag will contain the text in which we want to appear on our slide...</p>
            </div>
        </div>
    </div>
    <div class="item"><img src="img/bg1.jpg" style="height: 100%; width: 100%; display: block;">
        <div class="container">
            <div class="carousel-caption">
            <h1>Sara Cook</h1>
            <p>This tag will contain the text in which we want to appear on our slide...</p>
            </div>
        </div>
    </div>
    <div class="item"><img src="img/bg3.jpg" style="height: 100%; width: 100%; display: block;">
        <div class="container">
            <div class="carousel-caption">
            <h1>Sara Cook</h1>
            <p>This tag will contain the text in which we want to appear on our       slide...</p>
            </div>
        </div>
    </div>
</div> 
<a class="left carousel-control" href="myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span> 
</a>
<a class="right carousel-control" href="myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span> 
</a>
</div>

Upvotes: 0

Views: 153

Answers (1)

user2718994
user2718994

Reputation:

You're closing .carousel-inner right after opening it - it should instead wrap around each .item

Instead of:

<div class="carousel-inner"></div>

Use:

<div class="carousel-inner">

    <!-- Carousel images -->

</div> <!-- Close right before the carousel controls -->
<a class="left carousel-control" href="myCarousel" data-slide="prev">
... etc

Simplified example: http://jsfiddle.net/52VtD/486/

Upvotes: 1

Related Questions