<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>html模板</title>
<meta name="Keywords" content="关键词,关键词">
<meta name="description" content="">
<script type="text/javascript" src="f:/java/js/jquery.js"> </script>
<!--css,js-->
<style type="text/css">
*{margin:0;padding:0;}
.box{width:100%;height:450px;margin:0 auto;position:relative;z-index:0;}
.box .pic{width:100%;height:450px;position:absolute;top:0;left:0;}
.box .sel{width:120px;height:22px;position:absolute;bottom:10px;left:47%;border-radius:25px;background:rgba(0,0,0,.5);z-index:2;}
.box .sel ul{margin-top:3px;margin-left:20px;display:inline-block;}
.box .sel ul li{list-style:none;float:left;padding:0 5px;width:16px;height:16px;background:url('1.png') no-repeat center;cursor:pointer;}
.box .sel .focus{width:16px;height:16px;background:url('2.png') no-repeat center;}
</style>
</head>
<body>
<div class="box">
<div class="pic" style="background:url('1.jpg') no-repeat center"></div>
<div class="pic" style="background:url('2.jpg') no-repeat center"></div>
<div class="pic" style="background:url('3.jpg') no-repeat center"></div>
<div class="sel">
<ul>
<li class="focus"></li>
<li></li>
<li></li>
</ul>
</div>
</div>
<script type="text/javascript">
var mysetInterval = null;
var s = 1;
$(function(){
$(".box").find("li").mouseover(function(){
var _index = $(this).index();
$(this).addClass("focus").siblings().removeClass("focus");
$(".pic").css({"z-index":0,opacity:0})
$(".pic").eq(_index).stop().css({"z-index":1}).fadeTo('slow',1)
clearInterval(mysetInterval);
},function(){
play();
});
play();
});
function play(){
mysetInterval = setInterval(function(){
if(s>3){
s = 2;
}
$(".box").find("li").eq(s).addClass("focus").siblings().removeClass("focus");
$(".pic").css({"z-index":0,opacity:0});
$(".pic").eq(s).stop().css({"z-index":1}).fadeTo('slow',1);
if(s==2){
s=0;
}else{
s++;
}
},4000);
}
</script>
</body>
</html