Home > other >  Bootstrap 5 carousel stuck on first image
Bootstrap 5 carousel stuck on first image

Time:12-16

I'm trying to include a carousel in my html page, but it only shows the first image and even though the next and previous text appears I'm unable to navigate. I literally copy and pasted the code from bootstrap.

    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" href="../static/css/styles.css" />

              <div >
                <div id="carouselExampleIndicators"  data-ride="carousel">
                  <ol >
                    <li data-target="#carouselExampleIndicators" data-slide-to="0" ></li>
                    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                  </ol>
                  <div >
                    <div >
                      <img  src="../static/personal_website/code.png" alt="First slide">
                    </div>
                    <div >
                      <img  src="../static/personal_website/landing_page.png" alt="Second slide">
                    </div>
                  </div>
                  <a  href="#carouselExampleIndicators" role="button" data-slide="prev">
                    <span  aria-hidden="true"></span>
                    <span >Previous</span>
                  </a>
                  <a  href="#carouselExampleIndicators" role="button" data-slide="next">
                    <span  aria-hidden="true"></span>
                    <span >Next</span>
                  </a>
                </div>
              </div>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg OMhuP IlRH9sENBO0LRn5q 8nbTov4 1p" crossorigin="anonymous"></script>

CodePudding user response:

Try this:

<div >
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0"  aria-current="true" aria-label="Slide 1"></button>
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button>
  </div>
  • Related