jquery幻灯片
2016-12-01 21:02
363 查看
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
#wrap {
width: 590px;
height: 340px;
position: relative;
overflow: hidden;
margin: 100px auto;
border: #333 2px solid;
}
#wrap ol{
position: absolute;
left: 50%;
bottom: 10px;
margin-left: -70px;
}
#wrap ol li{
width: 30px;
height: 30px;
background: #ccc;
float: left;
margin-right: 5px;
border-radius: 50%;
}
#wrap ul {
position: absolute;
height: 340px;
}
#wrap ul li{
width: 590px;
height: 340px;
}
#wrap ol li.active{
background: red;
}
</style>
<script src="jquery.min.js"></script>
<script>
$(function(){
var aBtn = $('#wrap ol li');
var oUl = $('#wrap ul');
aBtn.hover(function(){
aBtn.removeClass('active');
$(this).addClass('active');
oUl.stop().animate({top:-340*$(this).index()});
});
});
</script>
</head>
<body>
<div id="wrap">
<ul>
<li><img src="img/s1.jpg" alt=""/></li>
<li><img src="img/s2.jpg" alt=""/></li>
<li><img src="img/s3.jpg" alt=""/></li>
<li><img src="img/s4.jpg" alt=""/></li>
</ul>
<ol>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
</ol>
</div>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
#wrap {
width: 590px;
height: 340px;
position: relative;
overflow: hidden;
margin: 100px auto;
border: #333 2px solid;
}
#wrap ol{
position: absolute;
left: 50%;
bottom: 10px;
margin-left: -70px;
}
#wrap ol li{
width: 30px;
height: 30px;
background: #ccc;
float: left;
margin-right: 5px;
border-radius: 50%;
}
#wrap ul {
position: absolute;
height: 340px;
}
#wrap ul li{
width: 590px;
height: 340px;
}
#wrap ol li.active{
background: red;
}
</style>
<script src="jquery.min.js"></script>
<script>
$(function(){
var aBtn = $('#wrap ol li');
var oUl = $('#wrap ul');
aBtn.hover(function(){
aBtn.removeClass('active');
$(this).addClass('active');
oUl.stop().animate({top:-340*$(this).index()});
});
});
</script>
</head>
<body>
<div id="wrap">
<ul>
<li><img src="img/s1.jpg" alt=""/></li>
<li><img src="img/s2.jpg" alt=""/></li>
<li><img src="img/s3.jpg" alt=""/></li>
<li><img src="img/s4.jpg" alt=""/></li>
</ul>
<ol>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
</ol>
</div>
</body>
</html>
相关文章推荐
- jQuery插件animateSlide制作多点滑动幻灯片
- jquery实现简单的自动播放幻灯片效果
- 60款很酷的 jQuery 幻灯片演示和下载
- jquery banner广告幻灯片图片轮播切换,模仿实现当当网滚动广告效果
- jQuery setTimeout实现幻灯片
- jQuery超精致图片轮播幻灯片特效代码分享
- jQuery.nivo.slider.js 幻灯片图片切换
- jQuery旋转木马式幻灯片轮播特效
- jquery 仿163网易图片新闻幻灯片展示
- 教你开发jQuery幻灯片插件
- 60款很酷的 jQuery 幻灯片演示和下载
- 15个幻灯片效果的JQuery插件
- 娘娘的 很牛的幻灯片插件 jquery
- 33个优秀的jQuery 教程分享(幻灯片、动画菜单)
- 25个很酷的jQuery滑动幻灯片实例分享
- 一款基于jQuery打造的滤镜百叶窗幻灯片特效
- jQuery 插件 Touchslider触摸、鼠标操作幻灯片交互脚本
- 9秒学院:带38种动画过渡效果的炫酷jQuery幻灯片插件
- jQuery 幻灯片插件(带缩略图功能)
- Jquery实现仿腾讯娱乐频道焦点图(幻灯片)特效