Carousel bootstrap is displayed incorrectly

0

I'm having problems with my Carousel in Bootstrap. I copied it as is, I downloaded jquery, bootstrap.js I also put the viewport

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />

  <title>Document</title>
  <style>
    .shine {}
  </style>
</head>

<body>
  <div class="continer">
    <div class="col-xs-8">
      <div id="carousel-ejemplo" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
          <li data-target="#carousel-ejemplo" data-slide-to="0" class="active"></li>
          <li data-target="#carousel-ejemplo" data-slide-to="1" class="active"></li>
          <li data-target="#carousel-ejemplo" data-slide-to="2" class="active"></li>
          <li data-target="#carousel-ejemplo" data-slide-to="3" class="active"></li>
          <li data-target="#carousel-ejemplo" data-slide-to="4" class="active"></li>
        </ol>
        <div class="carousel-inner" role="listbox">
          <div class="item-active">
            <img src="ten1.jpg" title="God of War" />
          </div>
        </div>
        <div class="carousel-inner" role="listbox">
          <div class="item-active">
            <img src="ten2.jpg" title="PUBG´S" width="928px" height="483px" />
          </div>
        </div>
        <div class="carousel-inner" role="listbox">
          <div class="item-active">
            <img src="ten3.jpg" title="Far Cry 5" width="928px" height="483px" />
          </div>
        </div>
        <div class="carousel-inner" role="listbox">
          <div class="item-active">
            <img src="ten4.jpg" title="Monster Hunter" width="928px" height="483px" />
          </div>
        </div>

        <div class="carousel-inner" role="listbox">
          <div class="item-active">
            <img src="ten5(yes).jpg" title="Fornite" width="928px" height="483px" />
          </div>
        </div>
        <!-- Controles -->
        <a class="left carousel-control" href="#carousel-ejemplo" role="button" data-slide="prev">
          <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
          <span class="sr-only">Previo</span>
        </a>
        <a class="right carousel-control" href="#carousel-ejemplo" role="button" data-slide="next">
          <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
          <span class="sr-only">Siguiente</span>
        </a>









      </div>
    </div>
  </div>
  <script src="js/jquery.js"></script>
  <script src="bootstrap.min.js"></script>
</body>

</html>

    
asked by José Luis Gonzalez Govea 24.05.2018 в 23:05
source

1 answer

0

I recommend reading the Bootstrap documentation: Carousel

There are a couple of errors in your code, let's review them:

  • The div that contains your carousel has a class name "continue" , change it to "container".

  • The elements of the ol "carousel-indicators" have all the "active" class , only the must first have it , I also recommend use the label "ul" instead of "ol"

  • After of the "carousel-indicators" it declares the "carousel-inner" is where the "carousel-item" will be created, which will be the div containing the images that will be happening in the carousel.

  • Only the first "carousel-item" must have the "active" class.

The carousel code could look like this:

<div id="carousel-ejemplo" class="carousel slide" data-ride="carousel">
    <ul class="carousel-indicators">
      <li data-target="#carousel-ejemplo" data-slide-to="0" class="active"></li>
      <li data-target="#carousel-ejemplo" data-slide-to="1" ></li>
      <!-- Resto de elementos -->
    </ul>
    <div class="carousel-inner">
      <div class="carousel-item active">
        <img src=".ten1.jpg" title="God of War" />
      </div>
      <div class="carousel-item">
        <img src=".ten2.jpg" title="PUBG´S" />
      </div>

     <!-- Resto de imagenes. -->
    </div>

    <!-- Controles -->
    <a class="carousel-control-prev" href="#carousel-ejemplo" role="button" data-slide="prev">
      <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      <span class="sr-only">Previo</span>
    </a>
    <a class="carousel-control-next" href="#carousel-ejemplo" role="button" data-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="sr-only">Siguiente</span>
    </a>
  </div>
    
answered by 25.05.2018 / 11:07
source