<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document
</title>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.css"/>
</head>
<body>
<style type="text/css">
.mt50{margin-top: 50px;}
.carousel-inner >.item img{width: 100%;height: 300px;}
</style>
<div class="container mt50">
<div class="carousel slide " id="banner" data-ride="carousel" data-interval="5000">
<ol class="carousel-indicators">
<li data-target="#banner" data-slide-to="0" class="active"></li>
<li data-target="#banner" data-slide-to="1" ></li>
<li data-target="#banner" data-slide-to="2" ></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="http://img-cdn2.luoo.net/site/201710/59df32615f7cf.jpg"/>
</div>
<div class="item">
<img src="http://img-cdn2.luoo.net/site/201710/59db18dd28759.jpg"/>
</div>
<div class="item">
<img src="http://img-cdn2.luoo.net/site/201710/59ddf17c9ce1e.jpg"/>
</div>
</div>
<a href="#banner" class="left carousel-control" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous
</span>
</a>
<a href="#banner" class="right carousel-control" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next
</span>
</a>
</div>
</div>
<a href="javascript:void(0);" id="prevbtn">上一张
</a>
<a href="javascript:void(0);" id="stopbtn">暂停
</a>
<a href="javascript:void(0);" id="playbtn">播放
</a>
<a href="javascript:void(0);" id="nextbtn">下一张
</a>
<script src="../../js/jquery-1.11.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
$('#banner').carousel({
interval: 5000,
pause:"hover",
wrap:true
});
$("#prevbtn").on("click",function(){
$("#banner").carousel("prev")
});
$("#nextbtn").on("click",function(){
$("#banner").carousel("next")
});
$("#playbtn").on("click",function(){
$("#banner").carousel("cycle")
});
$("#stopbtn").on("click",function(){
$("#banner").carousel("pause")
});
$('#banner').on('slide.bs.carousel', function () {
});
$('#banner').on('slid.bs.carousel', function () {
});
});
</script>
</body>
</html>
转载于:https://www.cnblogs.com/bilaisheng/p/10210939.html
相关资源:JAVA上百实例源码以及开源项目
转载请注明原文地址: https://mac.8miu.com/read-2023.html