Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different star color if user already voted? #25

Open
dmhendricks opened this issue Nov 24, 2017 · 6 comments
Open

Different star color if user already voted? #25

dmhendricks opened this issue Nov 24, 2017 · 6 comments

Comments

@dmhendricks
Copy link

Can you recommend the best way to make the stars a different color if the user has already voted?

For example, the stars are yellow and display the aggregate rating. However, if someone clicks to vote, the star colors change to red (to show that the user has voted and to distinguish from the aggregate color).

Thank you,
Daniel

@nashio
Copy link
Owner

nashio commented Nov 28, 2017

Hello @dmhendricks,
I have added an alternate variable for setting this state.
use ratedColor in the settings to change the color once you click to rate/vote
https://github.com/nashio/star-rating-svg/blob/master/src/jquery.star-rating-svg.js#L24

@SirPhemmiey
Copy link

Hello good day.
Please how can I have multiple colors for sets of values? For instance, the user clicks 1+ it the color is red, if the user clicks 3+ the color is blue and if the user clicks 4+ the color of the star is yellow. How is this achievable please?
Then one more thing, how can I add a CSS to the stars that'll make them be in a kind of box or so?
Thanks for your swift response.

@mayurpimple
Copy link

mayurpimple commented Aug 17, 2020

I have same requirement . any solution?

@nashio
Copy link
Owner

nashio commented Aug 18, 2020

I can see why the color per level would be useful, I'll try to work on a solution for this tonight.
@SirPhemmiey In regards to the "box", you would have to override with your own CSS

@nashio
Copy link
Owner

nashio commented Aug 18, 2020

Added functionality to define a color per rated level, check the example for "changing level colors" in the demo.
https://nashio.github.io/star-rating-svg/demo/

@mayurpimple
Copy link

ratedColors:['red', 'red', 'orange', 'green', 'green'] thanks its working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants