Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTML:
- <div id="progressBar"><div></div></div>
- CSS:
- #progressBar {
- width: 400px;
- height: 22px;
- border: 1px solid #111;
- background-color: #292929;
- }
- #progressBar div {
- height: 100%;
- color: #fff;
- text-align: right;
- line-height: 22px; /* same as #progressBar height if we want text middle aligned */
- width: 0;
- background-color: #0099ff;
- }
- JQUERY:
- function progress(percent, $element) {
- var progressBarWidth = percent * $element.width() / 100;
- $element.find('div').animate({ width: progressBarWidth }, 500).html(percent + "% ");
- }
- progress(80, $('#progressBar'));
Advertisement
Add Comment
Please, Sign In to add comment