BootStrap之JavaScript插件中的轮播图

先看效果:

img

实现:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 轮播图 </title>
    <link href="./BootStrap_3.3.7_libs/css/bootstrap.min.css" rel="stylesheet">
    <script src="./jQuery/jquery-3.2.1.min.js"></script>
    <script src="./BootStrap_3.3.7_libs/js/bootstrap.min.js"></script>
</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="./img/01.jpg" alt="...">
            <div class="carousel-caption">
                图片1
            </div>
        </div>
        <div class="item">
            <img src="./img/02.jpg" alt="...">
            <div class="carousel-caption">
                图片2
            </div>
        </div>
        <div class="item">
            <img src="./img/03.jpg" alt="...">
            <div class="carousel-caption">
                图片3
            </div>
        </div>
        <div class="item">
            <img src="./img/06.jpg" alt="...">
            <div class="carousel-caption">
                图片4
            </div>
        </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>

</body>
</html>

详情请查看:BootStrap之JavaScript 插件

posted @ 2020-04-05 16:55  LeeHua  阅读(341)  评论(0编辑  收藏  举报