焦点图切换代码 jQuery带进度条滚动图片轮播代码

奋发图强 2019-11-19 237 阅读

特效描述:利用jQuery实现 带进度条 滚动图片 轮播代码,利用jQuery实现带进度条滚动图片轮播代码

代码结构

1. 引入CSS

<link rel="stylesheet" href="css/main.css" />

2. 引入JS

<script src="js/jquery-1.11.1.min.js"></script>

<script src="js/unslider.min.js"></script>

3. HTML代码

<br /><br /><br />
<div class="banner" id="b04">
<ul>
<li class="slider-item"><a href="#"><img src="img/01.jpg" alt="小米进军泡面界,5块一桶还包邮?雷军回应;92女生:360关闭直播不诚恳,需周鸿祎道歉;传阿里即将控股A站|早报" width="640" height="480" ><span class="slider-title"><em>小米进军泡面界,5块一桶还包邮?雷军回应;92女生:360关闭直播不诚恳,需周鸿祎道歉;传阿里即将控股A站|早报</em></span></a></li>
<li class="slider-item"><a href="#"><img src="img/02.jpg" alt="如果你是创业者,你或许应该琢磨琢磨投资人是怎么想的" width="640" height="480" ><span class="slider-title"><em>如果你是创业者,你或许应该琢磨琢磨投资人是怎么想的</em></span></a></li>
<li class="slider-item"><a href="#"><img src="img/03.jpg" alt="傅盛:生物学思维给我的四个启示" width="640" height="480" ><span class="slider-title"><em>傅盛:生物学思维给我的四个启示</em></span></a></li>
<li class="slider-item"><a href="#"><img src="img/04.jpg" alt="重仓何小鹏" width="640" height="480" ><span class="slider-title"><em>重仓何小鹏</em></span></a></li>
<li class="slider-item"><a href="#"><img src="img/05.jpg" alt="深潜:王石的创业" width="640" height="480" ><span class="slider-title"><em>深潜:王石的创业</em></span></a></li>
</ul>
<div class="progress"></div>
<a href="javascript:void(0);" class="unslider-arrow04 pv"><img class="arrow" id="al" src="img/arrowl.png" alt="pv" width="20" height="35"></a>
<a href="javascript:void(0);" class="unslider-arrow04 next"><img class="arrow" id="ar" src="img/arrowr.png" alt="next" width="20" height="37"></a>
</div>
<script>
$(document).ready(function(e) {
var progress = $(".progress"),li_width = $("#b04 li").length;
var unslider04 = $('#b04').unslider({
dots: true,
complete:function(index){//自己添加的,官方没有
progress.animate({"width":(100/li_width)*(index+1)+"%"});
}
}),
data04 = unslider04.data('unslider');
$('.unslider-arrow04').click(function() {
var fn = this.className.split(' ')[1];
data04[fn]();
});
});
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>

演示地址下载地址

最新游戏