星星評價怎麼做?

$(".bstar1").mouseenter(function(e){
$('.bstar1').prop('src','images/star.png');
});
就是指標在哪裡,黃星星就會補滿bstar是灰的star是黃的我越寫越不對,這樣好像不通?怎麼寫才對?_____________________________更新
我寫這樣
$('.rate_bstar').hover(
function(){
$(this).prevAll().prop('src','images/star.png');
$(this).prop('src','images/star.png');
$(this).nextAll().prop('src','images/bstar.png');
},
function(){
$(this).prevAll().prop('src','images/bstar.png');
$(this).prop('src','images/bstar.png');
$(this).nextAll().prop('src','images/bstar.png');
}
);
發現這樣可以,但我點擊後我想讓他停在那個狀態,不要消失
鸿蒙传说
浏览 338回答 2
2回答

SMILET

$("#startImg").on("click",'img',a)$('#startImgimg').hover(a,b);functiona(){$(this).attr('src','images/star.png')$(this).prevAll().attr('src','images/star.png')$(this).nextAll().attr('src','images/bstar.png');}functionb(){$('#startImgimg').attr('src','images/bstar.png');}

回首忆惘然

$(".rate_bstar").mouseenter(function(e){$(this).attr('src','images/star.png').prevAll().attr('src','images/star.png');});鼠标离开的时候全部改回来就行了。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript