Re:How to Make Easy & Flexible Star Ratings
by ricardobeat on Saturday October 15, 2011 @12:49AM
(#3114063)
This method leaves all styling in your HTML/server-side code, which is a pita.
[ Parent
| on HN ]
Re:How to Make Easy & Flexible Star Ratings
by BerislavLopac on Saturday October 15, 2011 @03:28AM
(#3114350)
In an app I'm making, each group of items can have a different rating size, as defined by the group's admin. So the sprite with a fixed number of stars wouldn't work.
Essentially, I see a number of stars as just a different sort of a "progress-bar"-like graphic, so it's not necessary to set individual stars in the HTML. Just set it as a horizontally-repeating background, with predefined "steps" od the overlay, and the only number you need to pass from the server is the step level. This can even show a partial star if you want.
P.S. I haven't read the OP article prior to writing this comment; that's essentially what they're advising there.
Re:How to Make Easy & Flexible Star Ratings
by michaeldhopkins on Saturday October 15, 2011 @08:29PM
(#3116200)
This is avoided by rendering each star/half star/empty star as an li or a div, defining common styles like width, height and positioning and then background images for each.