Annita Lopes
Annita Lopes

Reputation: 3

My bootstrap carousel code doesn't work

I'm trying to make a slider and it's not working i think there is something wrong with my buttons, can someone tell me why?? I'm new at this so i don't know what's wrong....

This is my code:

`<head>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
</head>
<body>

<div id="carousel-example-generic" class="carousel slide" data-  ride="carousel">

<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>   

<div class="carousel-inner">
    <div class="item active">
        <img src="http://placehold.it/600x400" alt="...">
        <div class="carousel-caption">

        </div>
    </div>
    <div class="item">
        <img src="http://placehold.it/600x400" alt="">
        <div>
        ...
        </div>
    </div>
    <div class="item">
        <img src="http://placehold.it/600x400" alt="">
        <div>
        ...
        </div>
    </div>
</div>

<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
</body>`

Upvotes: 0

Views: 1472

Answers (1)

iurii
iurii

Reputation: 4230

Here is working code http://plnkr.co/edit/Xt0EhyVFNTgU3i8rvxHz?p=preview

<!doctype html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>

  <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">
        <img src="http://placehold.it/600x400" alt="...">
      </div>
      <div class="item">
        <img src="http://placehold.it/600x400" alt="...">
      </div>
      <div class="item">
        <img src="http://placehold.it/600x400" alt="...">
      </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>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>

I'm not sure why you have single quotes

`<head>
</body>`

and

'data-  ride='

with some extra spaces.

Upvotes: 1

Related Questions