1

I am using jQuery Raty JS, and i want score always in an interval of 0.5, no matter where it clicks on stars For eg. 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5

Expected result: stars should display in an interval of 0.5

Currently, the code is like

$('#custom_p').raty({
  half: true ,
  halfShow    : true,
  precision  : true,
  round      : { down: .25, full: .6, up: .76 },      
  click: function(score, evt) {
  alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt);
}});

Maybe have to look in round param

1 Answers1

1

I use

click: function(score, evt) {               
    var score = Math.round(score*2)/2;
}

But not the best way :/

  • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find [how to write a good answer](https://stackoverflow.com/help/how-to-answer) very helpful. Please edit your answer. – hellow Nov 08 '18 at 09:14