jquery raty get score in 0.5 interval

255 views Asked by At

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

There are 1 answers

1
Elie Najberg On

I use

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

But not the best way :/