码迷,mamicode.com
首页 > Web开发 > 详细

Bootstrap的js插件之轮播(carousel)

时间:2015-08-08 01:22:02      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:bootstrap   html5   前端   响应式   插件   

轮播请查看以下示例,基本已经涵盖最常用的一个轮播

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>js插件_轮播</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
    <!--<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">-->
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
        .myCarousel{
            width:50%;
        }
    </style>
</head>
<body>
<div class="container myCarousel">
    <div id="carousel-example-generic" class="carousel slide">
        <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="images/1.jpg"/>
                <div class="carousel-caption">
                    <h3>宅男女神1</h3>
                    <p>人气偶像票选890张</p>
                </div>
            </div>
            <div class="item">
                <img src="images/2.jpg"/>
                <div class="carousel-caption">
                    <h3>宅男女神2</h3>
                    <p>人气偶像票选1234张</p>
                </div>
            </div>
            <div class="item">
                <img src="images/3.jpg"/>
                <div class="carousel-caption">
                    <h3>宅男女神3</h3>
                    <p>人气偶像票选7836张</p>
                </div>
            </div>
        </div>
        <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
    </div>
</div>
<script>
    //设置图片切换时间,默认是5秒;
    $(".carousel").carousel({
        interval:2000
    })
</script>

</body>
</html>

技术分享

版权声明:本文为博主原创文章,未经博主允许不得转载。

Bootstrap的js插件之轮播(carousel)

标签:bootstrap   html5   前端   响应式   插件   

原文地址:http://blog.csdn.net/bboyjoe/article/details/47348099

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!