码迷,mamicode.com
首页 > 其他好文 > 详细

很有意思的层次轮播图

时间:2016-11-05 09:32:50      阅读:336      评论:0      收藏:0      [点我收藏+]

标签:技术   margin   isp   简单   hover   html   pad   center   .com   

这是我做的截图,可以根据鼠标来切换图片,挺有意思的。

里面重要的地方就是JQuery里的内容:大家好好看,我就不多说了,挺简单的

技术分享

 

技术分享

以下是全部代码:

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}

ul, ol {
list-style: none;
}

.wrap {
width: 700px;
height: 400px;
margin: 100px auto 0;
position: relative;
overflow: hidden;
border: 5px ridge rgb(166,226,46);
}

.wrap img {
display: block;
}

.wrap ul {
height: 400px;
z-index: 1;
position: relative;
}

.wrap ol {
height: 30px;
z-index: 2;
position: absolute;
bottom: 0;
right: 0;
}

.wrap > ul > li {
position: absolute;
top: 0;
left: 0;
}

.wrap > ol > li {
float: left;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
border: 1px solid white;
margin-right: 5px;
background: Gray;
border-radius: 10px;
color: white;

}

.wrap > ol > li:hover {
cursor: pointer;
}

.wrap li.active {
padding: 2px;
color: orange;
margin-top: -4px;
border: 1px solid orange;
border-radius: 12px;
}
img{
width: 700px;
height: 400px;
}
</style>
<script src="../jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function () {
var zIndex = 0;
$(".wrap > ol > li").mouseenter(function () {
zIndex++;
$(this).addClass("active").siblings().removeClass("active");
$(".wrap > ul > li")
.eq($(this).index())
.css({
"z-index": zIndex,
"left": 700
})
.animate({
"left": 0
}, 1000);
});
});
</script>
</head>
<body>
<div class="wrap">
<ul>
<li style="z-index:1;"><img src="images/1.jpg" /></li>
<li><img src="images/2.jpg" /></li>
<li><img src="images/3.jpg" /></li>
<li><img src="images/4.jpg" /></li>
<li><img src="images/5.jpg" /></li>
</ul>
<ol>
<li class="active">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ol>
</div>
</body>
</html>

很有意思的层次轮播图

标签:技术   margin   isp   简单   hover   html   pad   center   .com   

原文地址:http://www.cnblogs.com/jxj125233/p/6032405.html

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