五角星

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.wujiao{
display: inline-block;
width:100px;
height:100px;
background: url('timg1.png') no-repeat center;
background-size: cover;
}
.wujiao_active{
background: url('timg2.png') no-repeat center;
background-size: cover;
}

</style>
<script src="jquery-1.9.1.min.js"></script>
</head>
<body>
<div class="wujiaoCon">
<div class="wujiao"></div>
<div class="wujiao"></div>
<div class="wujiao"></div>
<div class="wujiao"></div>
<div class="wujiao"></div>
</div>
<script>
$(".wujiaoCon .wujiao").click(function(){
$(".wujiaoCon .wujiao").removeClass("wujiao_active");
$(".wujiaoCon .wujiao:lt("+($(this).index()+1)+")").addClass("wujiao_active")
})
</script>
</body>
</html>
posted @ 2018-06-23 10:23  刘浩2561179983  阅读(115)  评论(0编辑  收藏  举报