<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
font-size: 12px; | |
} | |
ul { | |
list-style: none; | |
} | |
a { | |
text-decoration: none; | |
} | |
.wrapper { | |
width: 250px; | |
height: 248px; | |
margin: 100px auto 0; | |
border: 1px solid pink; | |
border-right: 0; | |
overflow: hidden; | |
} | |
#left, | |
#content { | |
float: left; | |
} | |
#left li { | |
background: url(images/lili.jpg) repeat-x; | |
} | |
#left li a { | |
display: block; | |
width: 48px; | |
height: 27px; | |
border-bottom: 1px solid pink; | |
line-height: 27px; | |
text-align: center; | |
color: black; | |
} | |
#left li a:hover { | |
background-image: url(images/abg.gif); | |
} | |
#content { | |
border-left: 1px solid pink; | |
border-right: 1px solid pink; | |
} | |
</style> | |
<script src="jquery-3.3.1.min.js"></script> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<ul id="left"> | |
<li><a href="#">女靴</a></li> | |
<li><a href="#">雪地靴</a></li> | |
<li><a href="#">冬裙</a></li> | |
<li><a href="#">呢大衣</a></li> | |
<li><a href="#">毛衣</a></li> | |
<li><a href="#">棉服</a></li> | |
<li><a href="#">女裤</a></li> | |
<li><a href="#">羽绒服</a></li> | |
<li><a href="#">牛仔裤</a></li> | |
</ul> | |
<div id="content"> | |
<div> | |
<a href="#"><img src="images/女靴.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/雪地靴.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/冬裙.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/呢大衣.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/毛衣.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/棉服.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/女裤.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/羽绒服.jpg" width="200" height="250" /></a> | |
</div> | |
<div> | |
<a href="#"><img src="images/牛仔裤.jpg" width="200" height="250" /></a> | |
</div> | |
</div> | |
</div> | |
<script> | |
// 鼠标指针经过左侧的li | |
$("#left li").mouseover(function () { | |
var index = $(this).index(); // 得到当前li的索引 | |
console.log(index); | |
// 让右侧盒子相应索引的图片显示出来 | |
$("#content div").eq(index).show(); | |
// 将其他图片隐藏起来 | |
$("#content div").eq(index).siblings().hide(); | |
}); | |
</script> | |
</body> | |
</html> |
淘宝预览图(10.2.6)
于 2022-05-22 11:42:23 首次发布