-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiveStar.html
43 lines (40 loc) · 964 Bytes
/
fiveStar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
ul{
font-size:0;
}
li{
list-style:none;
display:inline-block;
font-size:40px;
}
</style>
</head>
<body>
<div>
<ul>
<li>☆</li>
<li>☆</li>
<li>☆</li>
<li>☆</li>
<li>☆</li>
</ul>
</div>
<script src="js/third/jquery-2.12.js"></script>
<script type="text/javascript">
var star = '★', star1 = '☆';
$('ul').on('mouseenter','li',function(){
$(this).text(star).prevAll().text(star).end().nextAll().text(star1);
}).on('click','li',function(){
$(this).addClass('clicked').siblings('li').removeClass('clicked');
}).on('mouseleave',function(){
$('ul li').text(star1);
$('.clicked').text(star).prevAll().text(star).end().nextAll().text(star1);
});
</script>
</body>
</html>