Jquery星级评级插件 - 半星不工作

时间:2013-03-13 10:03:38

标签: jquery rating

我正在实施jquery star rating plugin

单星影响工作正常,没问题。 但我似乎无法让半个明星工作......

html来源:

<div class="stars">
   <span class="star-rating-control"><div class="rating-cancel" style="display: none;"><a title="Cancel Rating"></a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="1">1</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="2">2</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="3">3</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="4">4</a></div><div role="text" aria-label="" class="star-rating rater-0 required {half:true} star-rating-applied star-rating-live" id="Answer1_Rating"><a title="5">5</a></div></span>
   <input class="required  {half:true} star-rating-applied" data-val="true" data-val-required="The Rating field is required." id="Answer1_Rating" name="Answer1.Rating" type="radio" value="1" style="display: none;">
   <input class="required  {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="2" style="display: none;">
   <input class="required  {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="3" style="display: none;">
   <input class="required  {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="4" style="display: none;">
   <input class="required  {half:true} star-rating-applied" id="Answer1_Rating" name="Answer1.Rating" type="radio" value="5" style="display: none;">
</div>

Jquery的:

 $('.stars :radio').rating();

2 个答案:

答案 0 :(得分:3)

来自http://www.fyneworks.com/jquery/star-rating/

  

使用元数据插件通过class属性将高级设置传递给插件。

http://archive.plugins.jquery.com/project/metadata

答案 1 :(得分:0)

@ mfo的链接不再有效了。它现在似乎在这里。

https://github.com/jquery-orphans/jquery-metadata

我用它,它对我有用。