jquery星级评分插件jquery.raty_滑动鼠标点击星星评分的功能插件
程序员文章站
2022-03-01 14:58:50
...
本DEMO是一款功能强大的jquery评分插件jquery.raty、可灵活设置33个参数、可以显示数值和自定义字符串数组
比以往分享的星级评分插件功能强多了、使用也比较简单、最简单的使用初始化jquery代码就一行$(”#star“).raty();
具体的大家自己下载下来慢慢看吧
HTML代码
<div style="width:500px; margin:100px auto;"> <div class="demo"> <div id="function-demo" class="target-demo"></div> <div id="function-hint" class="hint"></div> </div> <div class="demo"> <div id="function-demo1" class="target-demo"></div> <div id="function-hint1" class="hint"></div> </div> </div>JS代码
$(function() { $.fn.raty.defaults.path = ´lib/img´; $(´#function-demo´).raty({ number: 3,//多少个星星设置 targetType: ´hint´,//类型选择,number是数字值,hint,是设置的数组值 path : ´demo/img´, hints : [´差´,´一般´,´好´], cancelOff : ´cancel-off-big.png´, cancelOn : ´cancel-on-big.png´, size : 24, starHalf : ´star-half-big.png´, starOff : ´star-off-big.png´, starOn : ´star-on-big.png´, target : ´#function-hint´, cancel : false, targetKeep: true, targetText: ´请选择评分´, click: function(score, evt) { alert(´ID: ´ + $(this).attr(´id´) + " score: " + score + " event: " + evt.type); } }); $(´#function-demo1´).raty({ number: 10,//多少个星星设置 score: 2,//初始值是设置 targetType: ´number´,//类型选择,number是数字值,hint,是设置的数组值 path : ´demo/img´, cancelOff : ´cancel-off-big.png´, cancelOn : ´cancel-on-big.png´, size : 24, starHalf : ´star-half-big.png´, starOff : ´star-off-big.png´, starOn : ´star-on-big.png´, target : ´#function-hint1´, cancel : false, targetKeep: true, precision : false,//是否包含小数 click: function(score, evt) { alert(´ID: ´ + $(this).attr(´id´) + " score: " + score + " event: " + evt.type); } }); });最后给大家贴出源代码下载链接: http://dwtedx.com/download.html?bdkey=s/1pJ3CN7X 密码: afow