日期:2014-05-16 浏览次数:20373 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片滚动</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function(){
var $div_li =$("div.div_head ul li");
$div_li.click(function(){
$(this).addClass("active") //当前<li>元素高亮
.siblings().removeClass("active"); //去掉其它同辈<li>元素的高亮
var index = $div_li.index(this); // 获取当前点击的<li>元素 在 全部li元素中的索引。
$("div.content > div") //选取子节点。不选取子节点的话,会引起错误。如果里面还有div
.eq(index).show() //显示 <li>元素对应的<div>元素
.siblings().hide(); //隐藏其它几个同辈的<div>元素
}).hover(function(){
$(this).addClass("hover");
},function(){
$(this).removeClass("hover");
})
})
</script>
<script type="text/javascript">
window.onload=function(){
huadong("picBox","listBox","prev","next","prevTop","nextTop");
huadong("picBox1","listBox1","prev1","next1","prevTop1","nextTop1");
}
</script>
</head>
<body>
<style type="text/css">
* {
margin: 0;
padding: 0;
list-style-type: none
}
a,img {
border: 0
}
body {
font: 12px/180% Arial,Helvetica,sans-serif,"新宋体"
}
.div {
width: 599px;
float: left
}
.div_head {
width: 599px;
height: 35px;
float: left
}
.div_head li {
width: 120px;
height: 30px;
float: left;
cursor: pointer
}
.div_head .active {
background: #00bcf3;
color: #FFF
}
.mod18 {
width: 599px;
position: relative;
background: #f7f7f7
}
.mod18 .btn {
position: absolute;
width: 15px;
height: 70px;
bottom: 0;
cursor: pointer;
z-index: 99;
font-size: 50px;
font-weight: bold
}
.mod18 .prev {
left: 0;
background: url(images/prevBtn.png) no-repeat
}
.mod18 #prevTop,.mod18 #nextTop,.mod18 #prevTop1,.mod18 #nextTop1 {
top: 213px;
width: 46px;
height: 48px
}
.mod18 #prevTop,.mod18 #prevTop1 {
background: url(images/prevBtnTop.png) 0 0 no-repeat
}
.mod18 #nextTop,.mod18 #nextTop1 {
background: url(images/nextBtnTop.png) 0 0 no-repeat
}
.mod18 .next {
right: 0;
background: url(images/nextBtn.png) no-repeat
}
.mod18 li {
float: left
}
.mod18 .cf li {
position: relative;
color: #fff
}
.mod18 .cf a {
display: block;
width: 599px;
height: 415px;
position: absolute;
color: #fff
}