<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title> </title>
<meta name="description" content="">
<!--css js-->
<!--css: 层叠样式表,一件美丽的外衣-->
<!--内嵌样式-->
<style type="text/css">
/*全局样式*/
*{margin:0px;padding:0px;}
/*以“.”开头的css样式 称之为 类样式*/
.banner{width:100%;height:32px;background:url("images/1.jpg") no-repeat;
background-position:top center;padding-top:360px;
}
.banner .btn{width:87px;height:30px;margin:0 auto;}
.banner .btn ul li{list-style:none;float:left;
width:16px;height:16px;background:url("images/1.png") no-repeat;padding-left:10px;
background-position:center center;
}
.banner .btn ul .xz{background:url("images/2.png") no-repeat;
background-position:center center;
}
</style>
</head>
<body>
<!--div 层 盒子,容器-->
<!--以class="自定义名称" 称之为 类样式-->
<div class="banner">
<div class="btn">
<!--无序列表-->
<ul id="sel">
<li code="1" class="xz"></li>
<li code="2"></li>
<li code="3"></li>
</ul>
</div>
</div>
<!--引入jquery的官方类库-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("#sel").find("li").mouseover(function(){
var code = $(this).attr("code");
$(this).addClass("xz").siblings().removeClass("xz");
// fadeOut() 方法使用淡出效果来隐藏被选元素,假如该元素是隐藏的。
$(".banner").fadeOut(500,function(){
//fadeIn() 方法使用淡入效果来显示被选元素,假如该元素是隐藏的。
$(this).css("background","url(images/"+code+".jpg) no-repeat top center").fadeIn(500);
})
});
});
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title> </title>
<meta name="description" content="">
<!--css js-->
<!--css: 层叠样式表,一件美丽的外衣-->
<!--内嵌样式-->
<style type="text/css">
/*全局样式*/
*{margin:0px;padding:0px;}
/*以“.”开头的css样式 称之为 类样式*/
.banner{width:100%;height:32px;background:url("images/1.jpg") no-repeat;
background-position:top center;padding-top:360px;
}
.banner .btn{width:87px;height:30px;margin:0 auto;}
.banner .btn ul li{list-style:none;float:left;
width:16px;height:16px;background:url("images/1.png") no-repeat;padding-left:10px;
background-position:center center;
}
.banner .btn ul .xz{background:url("images/2.png") no-repeat;
background-position:center center;
}
</style>
</head>
<body>
<!--div 层 盒子,容器-->
<!--以class="自定义名称" 称之为 类样式-->
<div class="banner">
<div class="btn">
<!--无序列表-->
<ul id="sel">
<li code="1" class="xz"></li>
<li code="2"></li>
<li code="3"></li>
</ul>
</div>
</div>
<!--引入jquery的官方类库-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("#sel").find("li").mouseover(function(){
var code = $(this).attr("code");
$(this).addClass("xz").siblings().removeClass("xz");
// fadeOut() 方法使用淡出效果来隐藏被选元素,假如该元素是隐藏的。
$(".banner").fadeOut(500,function(){
//fadeIn() 方法使用淡入效果来显示被选元素,假如该元素是隐藏的。
$(this).css("background","url(images/"+code+".jpg) no-repeat top center").fadeIn(500);
})
});
});
</script>
</body>
</html>