dobtco / starrr

1-5 star rating, in jQuery.
dobtco.github.com/starrr
216 stars 106 forks source link

Does it supports decimals values? #40

Open qzi35 opened 5 years ago

qzi35 commented 5 years ago

Hello, does the plugin supports decimals values, for example to set de star at middle?

laminko commented 5 years ago

yeah, please support decimals, too.

devnox commented 4 years ago
results.push($stars.eq(i - 1).removeClass(rating >= i ? this.options.emptyClass : this.options.fullClass).addClass(rating >= i ? this.options.fullClass : this.options.emptyClass));

change to

results.push($stars.eq(i - 1).removeClass(Math.round(rating) >= i ? this.options.emptyClass : this.options.fullClass).addClass(Math.round(rating) >= i ? this.options.fullClass : this.options.emptyClass));

Math.round() does the job! :)

Cheers!