— link removed —
How can I convert the numbers in the above website into stars using Jquery with a for loop to add however many stars, and a round up, round down function.
I prefer to round using this example:
- 3.0 if lower than 3.25; this will include 3 full stars, 2 empty stars
- 3.5 if between 3.25 and 3.75; this will include 3 full stars and 1 half
star, 1 empty star - 4.0 if higherthan 3.75; this will include 4 full stars, 1 empty star
You would need to update your list of ratings to be in a selectable container, and the rading would need to be encapsulated in it’s own selector.
HTML:
JS:
The CSS I’ll leave up to you.
EDIT: Updated
$starsto use<div />instead of<span />