Math with 5 Star Rating and Width
Right Now I have a 5 star rating wi开发者_如何学Goth values ranging from 1-5. Behind these empty stars is a box whose width will be depending on the values of the votes. The width of the 5 stars = 150px. This means that if two people vote both with 2.5 stars I want the width of the background div to be 75px and so on. Anyone have an equation to go by?
var width = stars * 30;
:)
shouldn't 3-stars have a width of 90, not 75?
精彩评论