首页 > 其他 > 详细

评分案例

时间:2020-04-09 20:54:20      阅读:82      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>五角星评分案例</title>
<style>
* {
padding: 0;
margin: 0;
}

.comment {
font-size: 40px;
color: yellow;
}

.comment li {
float: left;
}

ul {
list-style: none;
}
</style>
<script src="jquery-1.12.2.js"></script>

<script>
// $(function () {
// //获取所有的li绑定鼠标进入和鼠标离开和点击事件
// $(".comment>li").mouseover(function () {
// $(this).text("★").prevAll("li").text("★").end().nextAll("li").text("☆");
// }).mouseout(function () {
// $(this).text("☆").prevAll("li").text("☆");
// //获取属性index为10的这个li和这个li前面所有的li
// $(".comment>li[index=10]").text("★").prevAll("li").text("★");
//
// }).click(function () {
// $(this).attr("index","10").siblings("li").removeAttr("index");
// });
// });
</script>
<script>

$(function () {
$(".comment>li").mouseover(function () {
$(this).text("★").prevAll("li").text("★").end().nextAll("li").text("☆");
}).mouseout(function () {
$(".comment").find("li").text("☆");
$(".comment>li[index=1]").text("★").prevAll("li").text("★")
}).click(function () {
$(this).attr("index","1").siblings("li").removeAttr("index");
});
});
</script>
</head>

<body>
<ul class="comment">
<li>☆</li>
<li>☆</li>
<li>☆</li>
<li>☆</li>
<li>☆</li>
</ul>
</body>

</html>

评分案例

原文:https://www.cnblogs.com/pxxdbk/p/12669059.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!