How we can create a circular progress bar using jQuery and CSS? Solution: jQuery Circular Progress Bar With CSS. In other words, Circle/Radial Progress Bar.
Maybe you know about the progress bar, It is a graphical element that shows the progression of the operation. Previously I have shared a normal progress bar which is horizontal. In simple words, a progress bar shows 0% to selected condition’s percentage with an animation-delay. In the circle bar, there will fill stroke 0 to selected percent.
Today you will learn to create a redial or circle progress bar. You can use this program in many places like your skills level in different fields Like you are an expert in HTML then fill it above 95%, and beginner in JS the fill it below 20%, etc. You can see in the preview I have also used this in the same way.
So, Today I am sharing jQuery Circular Progress Bar with CSS. For this program, I have used a jquery based library which is specially made for creating circular progress bars. With the library, we can create these kinds of progress bars very easily. For creating the whole layout used bootstrap, because with using it we can create responsive element quickly.
If you are thinking now how this circular or radial progress bar actually is, then see the preview given below.
Preview Of Circle/Radial Progressing Bar
See this video preview to getting an idea of how this bar looks like.
Now you can see this visually. If you like this, then get the source code of its.
You May Also Like:
- JavaScript Multi Step Form
- CSS Blend Modes With JS
- Highlight Current & Active Link
- Dark and Light Mode Switch
jQuery Circular Progress Bar With CSS Source Code
Before sharing source code, let’s talk about it. As you know I used a special library which is circle-progress.min.js for creating this program. For creating the layout I used Bootstrap grid. All the circle’s data like size, value is handled by HTML data-* command. In past I shared many program based on HTML data-* command. Basically, the data-* attribute gives us the ability to embed custom data attributes on all HTML elements.
For putting the value 65% I used data-value="0.65" & for the circle size used data-size="200" . You can changes values, circle’s size by changing these data’s values. Also, data attribute controlling the stroke thickness for progress using data-thickness="6" you can also increase & decrease stroke size by changing the value.
In the CSS section, I managed all the positions, font, & color values. Also, JS file has a very short part, because we are using a library. This library has prebuilt functions we just have to put them on our code. After getting the codes you will understand how this works. If you have knowledge on JavaScript then you will definitely understand easily.
For creating this circular bar you have to create 3 files, First for HTML, second for CSS, & third for JS. Follow the steps to creating this without any error.
index.html
Create an HTML file named ‘index.html‘ and put these codes given below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
<!DOCTYPE html> <!--Code By Webdevtrick ( https://webdevtrick.com )--> <html lang="en" > <head> <meta charset="UTF-8"> <title>Circle Progress Bar | Webdevtrick.com</title> <link href="https://fonts.googleapis.com/css?family=Staatliches&display=swap" rel="stylesheet"> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css'> <link rel="stylesheet" href="style.css"> </head> <body> <section id="circleBar"> <h1>Circle Progress Bar</h1> <p>These Circle Progress Bars Created Using JQuery's Special Library</p> <div class="container"> <div class="row"> <div class="col-md-3"> <div class="round" data-value="0.87" data-size="200" data-thickness="6"> <strong></strong> <span><i class="fa fa-html5" aria-hidden="true"></i> HTML Skill</span> </div> </div> <div class="col-md-3"> <div class="round" data-value="0.74" data-size="200" data-thickness="6"> <strong></strong> <span><i class="fa fa-css3" aria-hidden="true"></i> CSS Skill</span> </div> </div> <div class="col-md-3"> <div class="round" data-value="0.65" data-size="200" data-thickness="6"> <strong></strong> <span><i class="fa fa-jsfiddle" aria-hidden="true"></i> JavaScript Skill</span> </div> </div> <div class="col-md-3"> <div class="round" data-value="0.95" data-size="200" data-thickness="6"> <strong></strong> <span><i class="fa fa-laptop" aria-hidden="true"></i> Bootstrap Skill</span> </div> </div> </div> </div> <button class="btn" onClick="Circlle('.round');">Refresh</button> </section> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-circle-progress/1.2.0/circle-progress.min.js'></script> <script src="function.js"></script> </body> </html> |
style.css
Now create a CSS file named ‘style.css‘ and put these codes given here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
/* Code By Webdevtrick ( https://webdevtrick.com ) */ #circleBar { margin-top: 200px; text-align: center; font-family: 'Staatliches', cursive; } #circleBar .round { min-height: 255px; margin-top: 30px; position: relative; margin-bottom: 20px; } #circleBar .round strong { position: absolute; top: 50%; left: 50%; margin-top: -50px; transform: translate(-50%); font-size: 40px; color: #212121; font-weight: 100; } #circleBar span { display: block; color: #999; font-size: 16px; margin-top: 10px; } #circleBar span i { color: #ff5c5c; font-size: 22px; margin-right: 6px; } section button:hover { background-color: #ff5c5c; } |
function.js
The final step, Create a JavaScript file named ‘function.js‘ and put the codes.
1 2 3 4 5 6 7 8 |
/* Code By Webdevtrick ( https://webdevtrick.com ) */ function Circlle(el){ $(el).circleProgress({fill: {color: '#ff5c5c'}}) .on('circle-animation-progress', function(event, progress, stepValue){ $(this).find('strong').text(String(stepValue.toFixed(2)).substr(2)+'%'); }); }; Circlle('.round'); |
That’s It. Now you have created jQuery Circular Progress Bar With CSS, A Circle/Radial Progress Bar using HTML, CSS, jQuery, & Bootstrap. If you have any doubt or question comment down below.
Thanks For Visiting, Keep Visiting.
Brother, loved your work… Hope to see more of your work
Thanks, Stay connected for new posts.
Thank you shaan , still waitt of other post
But , make more about PHP shaan
sure, thanks for your comment
Woo this is amazing mujhe bhi sikhna h ye sab please help me
bhai aap link building krne aye ho ys sach me sikhna he aapko?
Bhai pdf upload karo na pls…..
Nice tutorial
Tutorials ki pfd upload dya kaarooooo brooooo
Sure, I will try.
How width out on click display circular progress bars.
this is great tutorial.
but i slightly can not understand about “setting the speed of progress”. i want to make the progress of filling the cirecle slower. how to set it ?
thank you
great work
how to set value 100%
how to make those left percentage area trasparent??? any idea bro??
Hi Shaan,
This is truly amazing work here. Thanks for sharing your expertise. How would I change the color of the circle behind the progress bar?
Is there an argument, like the one below that can set the grey circle color?
$(el).circleProgress({fill: {color: ‘#daaf48’}})
If I download circle-progress.min.js file. Then how can I use it? Waiting for your reply. Thank you