简单教程
提交运行
代码编辑器:
<!DOCTYPE htm> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.bootcss.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet"> <style>body {margin:10px}</style> <div class="container"> <div class="row"> <div class="span5"> <div id="myCarousel" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <div class="active item"> <img src="/static/i/css/paris.jpg" height="160px"/> </div> <div class="item"> <img src="/static/i/css/paris2.jpg" height="160px"/> </div> <div class="item"> <img src="/static/i/css/paris3.jpg" height="160px"/> </div> <div class="item"> <img src="/static/i/css/paris1.jpg" height="160px"/> </div> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a> </div> </div> </div> </div> <script src="/static/lib/bootstrap/2.3.2/docs/assets/js/jquery.js"></script> <script src="/static/lib/bootstrap/2.3.2/docs/assets/js/bootstrap.min.js"></script> <script> $('.carousel').carousel({ interval: 1000 // in milliseconds }) </script>
运行结果: