#
个人博客新地址:→点我♪(^∀^●)ノ
代码如下:
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin:0;
padding:0;
}
ul li{
list-style: none;
float: left;
width: 240px;
height: 400px;
}
ul{
width: 1300px;
}
div{
width:1150px;
height: 400px;
margin:50px auto;
overflow: hidden;
border:1px solid red;
}
</style>
<script src="js/myJquery1.4.js"></script>
</head>
<body>
<div>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<script>
//给所有的li添加背景图
var div = document.getElementsByTagName('div')[0];
var ul = div.children[0];
var liArr = ul.children;
for(var i=0;i<liArr.length;i++){
liArr[i].style.background = "url(images/player/"+(i+1)+".jpg)";
//鼠标移入li,这个li宽度变为800,其他的li变100;
liArr[i].onmouseover = function(){
for(var j=0;j<liArr.length;j++){
animation(liArr[j],{"width":"100px"});
}
animation(this,{"width":"800px"})
}
//鼠标移出li,这个li变回原样240
liArr[i].onmouseout = function(){
for(var j=0;j<liArr.length;j++){
animation(liArr[j],{"width":"240px"});
}
}
}
</script>
</body>
</html>