Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Radial Progress Bar"
Bootstrap 3.1.0 Snippet by
sumi9xm
3.1.0
progress bar
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
3.9K
 
2 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div id="number"></div> <div id="first-half"></div> <div id="second-half"></div> <input oninput="updateProgress(this)" type="range" min="0" max="100" value="15" step="1" id="range" name=""> </input> <div id="jumpList"> <h4>Animate to specific value:</h4> <button onclick="animateProgress(30)">30</button> <button onclick="animateProgress(50)">50</button> <button onclick="animateProgress(80)">80</button> </div>
#number { font-size: 40px; line-height: 80px; padding: 20px; color: black; background: white; box-sizing: border-box; border-radius: 50%; box-shadow: 0 0 0 4px black, inset 0 0 0 4px black; border: 60px solid white; text-align: center; width: 240px; height: 240px; margin: 30px auto; } #first-half, #second-half { margin: auto; width: 240px; height: 240px; box-sizing: border-box; background: transparent; border-radius: 50%; transform: rotate(-45deg); } #first-half { border: 60px outset blue; margin-top: -270px; } #second-half { border: 60px inset blue; margin-top: -240px; } #range { width: 240px; margin: 60px auto; display: block; } #jumpList { width: 240px; margin: auto; text-align: center; } #jumpList button { margin: 0 10px; padding: 10px; }
window.onload = function() { updateProgress(document.getElementById("range")); } function updateProgress(element) { var slider = document.getElementById("range"); var progress = document.getElementById("number"); var first = document.getElementById("first-half"); var secnd = document.getElementById("second-half"); var angle = -45; progress.innerHTML = element.value; if (element.value >= element.max / 2) { first.style.borderColor = "blue transparent transparent blue"; secnd.style.borderColor = "transparent blue blue transparent"; secnd.style.transform = "rotate(-45deg)"; } else if (element.value < element.max / 2 && element.value >= element.max / 4) { first.style.borderColor = "blue transparent transparent transparent"; secnd.style.borderColor = "transparent blue transparent transparent"; secnd.style.transform = "rotate(-45deg)"; } else if (element.value < element.max / 4) { first.style.borderColor = "blue transparent transparent transparent"; secnd.style.borderColor = "transparent white white transparent"; secnd.style.transform = "rotate(-225deg)"; } angle += (360 / slider.max) * element.value; first.style.transform = "rotate(" + angle + "deg)"; angle = -45; } function animateProgress(target) { element = document.getElementById('range'); if (element.value < target) { var animation = setInterval(function() { element.stepUp(); updateProgress(element); if (element.value >= target) { clearInterval(animation); } }, 1); } if (element.value > target) { var animation = setInterval(function() { element.stepDown(); updateProgress(element); if (element.value <= target) { clearInterval(animation); } }, 1); } }
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76