Scoring plugin Jquery.raty.js

Source: Internet
Author: User
<span id="Label3"></p><p><p>Originally want to use bootstrap-star-rating, is upload plug-in that group to do. But it's still a CSS Problem.</p></p><p><p>Later Baidu has a few things, the first page will be able to search, it may be linked to.</p></p><p><p>* @version 2.5.2<br>* @since 2010.06.11<br>* @author Washington Botelho<br>* @documentation Wbotelhos.com/raty</p></p><p><p>Very old one thing, can use just Fine.</p></p><pre><pre><span style="color: #0000ff;"><</span><span style="color: #800000;"></span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">= "star{{ite. $id}}"</span> <span style="color: #ff0000;"> ng-bind</span><span style="color: #0000ff;">= "getrating (this,ite)"</span> <span style="color: #0000ff;"> ></</span><span style="color: #800000;">div</span><span style="color: #0000ff;">><br><script src= "@Url. Content (" ~/content/component/star-rating/jquery.raty.js ")" ></script><br></span></pre></pre><p><p>This ite is a circular data, star plug-in as long as the inside a score on the line</p></p><p><p>Generally speaking, the score is the 0~10, half the star is 0.5, but we ask for a half-star is 1</p></p><p><p>So:</p></p><pre>$scope. getrating =<span style="color: #0000ff;"><span style="color: #0000ff;">function</span></span><span style="color: #000000;"><span style="color: #000000;">(o, obj) {$ (</span></span>"#star" +<span style="color: #000000;"><span style="color: #000000;">obj. $id). Raty ({path:</span></span>' @Url. Content ("~/content/component/star-rating/img/") '<span style="color: #000000;"><span style="color: #000000;">,//this is the star chart = = where there are selected/not selected/half-selected 3 click:</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">function</span></span><span style="color: #000000;"><span style="color: #000000;">(score, Evt) {obj. Score</span></span>= Score * 2<span style="color: #000000;"><span style="color: #000000;">;//here x2}, half:</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">true</span></span><span style="color: #000000;"><span style="color: #000000;">,//this is the opening half of the readOnly: $scope. sstate</span></span>! = 1<span style="color: #000000;"><span style="color: #000000;">, score:obj. Score</span></span>/2<span style="color: #000000;"><span style="color: #000000;">,//here to divide 2--size:</span></span>24<span style="color: #000000;"><span style="color: #000000;">, Hints: [</span></span>2, 4, 6, 8, 10<span style="color: #000000;"><span style="color: #000000;">]//here also to change}); }</span></span></pre><p><p>And then, I have a request on this side, mouse up to show 123456789 points = =</p></p><p><p>This will change the source file Jquery.raty.js.</p></p><p><p>Add a line to the _roundstars method</p></p><p><p>This.stars.eq (math.ceil (score)-1). attr (' title ', score * 2);</p></p><p><p>Otherwise the title (I.E. the text displayed on the Mouse) will be initialized (hints: [2, 4, 6, 8, 10]) showing only 246810</p></p><p><p>The whole paragraph is like this, but there's a question 10 points and 0 points don't seem to show, but it doesn't matter = =</p></p><pre>---------------------------------------------------------<span style="color: #000000;"><span style="color: #000000;">}, _roundstars:</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">function</span></span><span style="color: #000000;"><span style="color: #000000;">(score) {</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">var</span></span>Rest = (score-math.floor (score)). toFixed (2<span style="color: #000000;"><span style="color: #000000;">); </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(rest ><span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span><span style="color: #000000;"><span style="color: #000000;">. Opt.round.down) { </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">var</span></span>icon = ' Staron ';<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">up <span style="color: #008000;">: [x.76. x.99]</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. opt.halfshow && Rest <<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. opt.round.up) {<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">half: [x.26. x.75]</span></span>icon = ' Starhalf '<span style="color: #000000;"><span style="color: #000000;">; } </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">Else</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(rest <<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. opt.round.full) {<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">down <span style="color: #008000;">: [x.00. x.5]</span></span>icon = ' Staroff '<span style="color: #000000;"><span style="color: #000000;">; } </span></span><span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. Stars.eq (math.ceil (score)-1). attr (' src ',<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. Opt.path +<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span><span style="color: #000000;"><span style="color: #000000;">. opt[icon]); } </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">full <span style="color: #008000;">-down: [x.00. x.]</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. Stars.eq (math.ceil (score)-1). attr (' title ', score * 2<span style="color: #000000;"><span style="color: #000000;">); }, _target:</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">function</span></span><span style="color: #000000;"><span style="color: #000000;">(score, Evt) {</span></span>---------------------------------------------------------</pre><p><p></p></p><p><p>Scoring plugin Jquery.raty.js</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.