五星好評外掛 js + html +css
阿新 • • 發佈:2018-12-10
$(function(){
var wjx_none = '☆'; // 空心五角星
var wjx_sel = '★'; // 實心五角星
//滑鼠移進變實星
$(".comment li").on("mouseover",function(){
$(this).text(wjx_sel).prevAll("li").
text(wjx_sel).end().nextAll().text(wjx_none);
$("#aaa").val($(this).val());
});
//滑鼠移出變空星
$(".comment li").on("mouseout",function(){
if($("li.current").length === 0){
$(".comment li").text(wjx_none);
}else{
$("li .current").text(wjx_sel).prevAll().text(wjx_sel).end().nextAll().text(wjx_none);
}
});
//滑鼠點選保持當前狀態
$(".comment li").on("click",function(){
$(this).attr("class","current").siblings().removeClass("current");
$("#aaa").val($(this).val());
// alert($(this).val());
});
});