<script>
var kong="☆";
var shi="★";
$(function(){
//鼠标经过事件
$(".comment li").on("mouseenter",function(){
$(this).text(shi).prevAll().text(shi);
$(this).nextAll().text(kong);
});
//鼠标离开事件
$(".comment").on("mouseleave",function(){
$(this).children().text(kong).prevAll().text(kong);
//这个标记的类不存在就不执行
$(".current").text(shi).prevAll().text(shi);
});
//鼠标点击事件,给它做个标记
$(".comment li").on("click",function(){
$(this).addClass("current").siblings().removeClass("current");
});
});
</script>
jq实现五星评论
最新推荐文章于 2022-11-01 11:27:13 发布