欢迎您  本站地址:   jQuery鼠标滑过五角星打分星级评分代码-小库平台

小库平台

 找回密码
 立即注册
jQuery鼠标滑过五角星打分星级评分代码-小库平台

小库平台

 找回密码
 立即注册
上一主题 下一主题

jQuery鼠标滑过五角星打分星级评分代码

跳转到指定楼层
楼主
|只看大图 回帖奖励 |倒序浏览 |阅读模式

jQuery鼠标滑过五角星打分星级评分代码是一款5颗星10分制的jQuery滑动星星评分插件,可取消评分结果,重新打分。

js代码
<script>
$(function(){
//评分
varstarRating=0;
$('.photospan').on('mouseenter',function(){
varindex=$(this).index()+1;
$(this).prevAll().find('.high').css('z-index',1)
$(this).find('.high').css('z-index',1)
$(this).nextAll().find('.high').css('z-index',0)
$('.starNum').html((index*2).toFixed(1)+'分')
})
$('.photo').on('mouseleave',function(){
$(this).find('.high').css('z-index',0)
varcount=starRating/2
if(count==5){
$('.photospan').find('.high').css('z-index',1);
}else{
$('.photospan').eq(count).prevAll().find('.high').css('z-index',1);
}
$('.starNum').html(starRating.toFixed(1)+'分')
})
$('.photospan').on('click',function(){
varindex=$(this).index()+1;
$(this).prevAll().find('.high').css('z-index',1)
$(this).find('.high').css('z-index',1)
starRating=index*2;
$('.starNum').html(starRating.toFixed(1)+'分');
alert('评分:'+(starRating.toFixed(1)+'分'))
})
//取消评分
$('.cancleStar').on('click',function(){
starRating=0;
$('.photospan').find('.high').css('z-index',0);
$('.starNum').html(starRating.toFixed(1)+'分');
})
//确定评分
$('.sureStar').on('click',function(){
if(starRating===0){
alert('最低一颗星!');
}else{
alert('评分:'+(starRating.toFixed(1)+'分'))
}
})
})
</script>



下载
回复

使用道具 举报

小黑屋|小库平台

GMT+8, 2024-9-20 19:29 , Processed in 2.079666 second(s), 19 queries , Xcache On.

Powered by Discuz! 3.4

小库提示

扫描下方二维码,访问手机版。