Skip to content

Conversation

@pastudan
Copy link

@pastudan pastudan commented Aug 8, 2013

I am creating a widget which changes the color of a progress bar depending on it's percentage completion, and need to use this in multiple locations, so I updated the code to support percent widths and heights.

Unfortunately, I have to calculate the percent values from the element and it's parent's height or width, and I can not seem to get them to consistently come out exactly to what they are set to for the element, even if I round up / down.

I have tried using clientWidth and offsetWidth, but these only seem to return integer values. Perhaps someone knows of a better way to calculate percentage of an element?

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

Successfully merging this pull request may close these issues.

1 participant