javiertoledo / bootstrap-rating-input

Another plugin that eases the generation of rating stars for jQuery and Bootstrap
MIT License
319 stars 155 forks source link

Add rating class to .rating-input #30

Closed KennethDanielsen closed 9 years ago

KennethDanielsen commented 9 years ago

Hi there,

Awesome plugin!

I'm looking for a way to change the color of my stars depending on the active rating (I'm using an icon font). Is there a way to add the current/active rating as a class or data-rating attribute to the rating-input container?

Thanks in advance

javiertoledo commented 9 years ago

Maybe using the data-value field to build your CSS selector?

.rating-input i {
   color: black; //Black for 1 to 4
 }
.rating-input i[data-value=5] {
  color: yellow; //Yellow for 5
}
.rating-input i[data-value=6] {
  color: red; //Red for 6
}