微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Bootstrap 4 Carousel 控制按钮不工作

如何解决Bootstrap 4 Carousel 控制按钮不工作

我不确定我做错了什么,但由于某种原因,bootstrap 4 carousel 控件无法正常工作,如果有人可以提供帮助,我将不胜感激。我已经玩了大约一个小时的代码,所以我想我会得到第二个意见,看看发生了什么。

我查看了引导程序文档,然后复制并粘贴了控件。我看了看课程,一切看起来都一样

 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous">
 <!-- REVIEWS -->

<div id="reviews" class="py-3 bg-green" style="background: #186160;">

    <div class="customer-reviews  d-block text-center">
        <h4> <strong> Customer Reviews </strong></h4>
        <div style="color: #ffd400;"> &#9733; &#9733; &#9733; &#9733; &#9733;</div>

        <!-- SLIDER -->

    <div class="col-lg-10 offset-lg-1  text-light">
        <div id="carouselExampleControls" class="carousel slide" data-ride="carousel" >
            <div class="carousel-inner" role="listBox">
                <!-- SLIDER 1 -->
                <div class="carousel-item active text-center pt-4 ">
                    <blockquote class="blockquote text-center">
                        <div class="d-flex justify-content-around">
                            <div>
                                <p class="mb-0"><i class=" "></i> "I absolutely love this site,probably better than cebook"</p>
                                <p style="color: #ffd400;">Tomi_Jug****</p>
                            </div>
                            <div>
                                <p class="mb-0"><i class=" "></i> "I love all the users on this site,everyone is fun to talk with."</p>
                                <p style="color: #ffd400;">Chris****</p>
                            </div>

                        </div>
                    </blockquote>
        </div>
    <!-- SLIDER 2 -->
        <div class="carousel-item  text-center pt-4 ">
            <blockquote class="blockquote text-center">
                <div class="d-flex justify-content-around">
                    <div>
                        <p class="mb-0"><i class=" "></i> "I like the freedom it gives me to express,in a safe manner."</p>
                        <p style="color: #ffd400;">YoruUs**</p>
                    </div>
                    <div>
                        <p class="mb-0"><i class=" "></i> "I love that it's easy to chat with someone. You have a great mobile app. Easy to use."</p>
                        <p style="color: #ffd400;">HG****</p>
                    </div>

                </div>
            </blockquote>
        </div>
        <!-- SLIDER 3 -->
        <div class="carousel-item  text-center pt-4 ">
            <blockquote class="blockquote text-center">
                <div class="d-flex justify-content-around">
                    <div>
                        <p class="mb-0"><i class=" "></i> "I like that the site has cool people on it,and I can almost always meet someone new."</p>
                        <p style="color: #ffd400;">Wet an******</p>
                    </div>
                    

                </div>
            </blockquote>
        </div>

        <!-- Left and right controls -->
      <a class="carousel-control-prev" href="#demo" data-slide="prev">
          <span class="carousel-control-prev-icon"></span>
      </a>
      <a class="carousel-control-next" href="#demo" data-slide="next">
          <span class="carousel-control-next-icon"></span>
      </a>

        
    </div>
    
    <!-- SLIDER -->
  <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
    integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
    crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx"
    crossorigin="anonymous"></script>

解决方法

ID 不同。

更改为

    <!-- Left and right controls -->
             <a class="carousel-control-prev" href="#carouselExampleControls" data-slide="prev">
          <span class="carousel-control-prev-icon"></span>
             </a>
             <a class="carousel-control-next" href="#carouselExampleControls" data-slide="next">
            <span class="carousel-control-next-icon"></span>
         </a>

并检查

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。