JQuery Rating的具体用法 详见 官网:http://www.wbotelhos.com/raty/
但是我在网上找的一些资料上有一个大坑,关于
$('#fixed').raty({ readOnly: true, start: 2 }); <div id="fixed"></div>
只读用法
我用start设置,但是没有效果,
让我无奈的是网上的所以教程都是这样写的,我就觉得是版本的问题。
然后一看源码jquery.raty.js就知道了
最后面有这样一段代码”
$.fn.raty.defaults = { cancel : false, cancelHint : 'cancel this rating!', cancelOff : 'cancel-off.png', cancelOn : 'cancel-on.png', cancelPlace : 'left', click : undefined, half : false, halfShow : true, hints : ['bad', 'poor', 'regular', 'good', 'gorgeous'], iconRange : undefined, mouseover : undefined, noRatedMsg : 'not rated yet', number : 5, path : 'img/', precision : false, round : { down: .25, full: .6, up: .76 }, readOnly : false, score : undefined, scoreName : 'score', single : false, size : 16, space : true, starHalf : 'star-half.png', starOff : 'star-off.png', starOn : 'star-on.png', target : undefined, targetFormat : '{score}', targetKeep : false, targetText : '', targetType : 'hint', width : undefined };
由此可以看出, 显示星星的个数不是用start 而是用score