<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
.wrap{
width: 1178px;
height: 174px;
overflow: hidden;
position: relative;
margin: 0 auto;
}
.wrap ul li{
float: left;
width: 210px;
height: 174px;
overflow: hidden;
}
.wrap ul{
width: 2000px;
}
.wrap ul li img{
width: 550px;
height: 174px;
}
</style>
</head>
<body>
<div class="wrap">
<ul>
<li style='width:550px'><img src="http://pic.shejiben.com/hot_sjb/377_8180.jpg?1462261126" alt=""></li>
<li ><img src="http://pic.shejiben.com/hot_sjb/377_8288.jpg?1464830033" alt=""></li>
<li ><img src="http://pic.shejiben.com/hot_sjb/377_8155.jpg?1460709517" alt=""></li>
<li ><img src="http://pic.shejiben.com/hot_sjb/377_7937.jpg?1456984280" alt=""></li>
</ul>
</div>
<script src="../jquery.js"></script>
<script>
$(".wrap").find("li").mouseover(function(){
// console.log(this);
// $(this).animate({
// width:550
// })
// 先清除所有,再设置当前:$(this).index()获取当前元素的索引
$(".wrap").find("li").stop().animate({
width:210
}).eq( $(this).index() ).stop().animate({
width:550
})
console.log($(this).index())
.animate({
width:550
})
// 先设置当前,再清除其他:siblings()所有兄弟选择器
// $(this).stop().animate({
// width:550
// }).siblings().stop().animate({
// width:210
// })
})
</script>
</body>
</html>
jq手风琴效果
最新推荐文章于 2022-11-20 20:53:52 发布