JQuery multicolor progress bar

This is not so much a question as information that I want to share in the hope that it can help others with jQuery progress bars.

I was recently asked to create a progress bar that displays the number of days remaining in a given quarter of the year for when to review the training. The bar should be multi-colored (green, yellow, red) and the bar only appeared during the second month of the quarter and remained until the 16th of the third month in the quarter.

Sometimes it can be a simple request that can hurt us in development.

enter image description here

This is a screenshot of the final results using jQuery, javascript, html and css

You can find a working copy of the jsFiddle Example page

            (function ($) {
            $.fn.animateProgress = function (progress, callback) {
                return this.each(function () {
                    $(this).animate({
                        width: 100 - progress + '%',
                        left: progress + '%'
                    }, {
                        duration: 1000,
                        easing: 'swing',
                        step: function (progress) {
                            var labelEl = $('.ui-label', this),
                                valueEl = $('.value', labelEl);
                        },
                        complete: function (scope, i, elem) {
                            if (callback) {
                                callback.call(this, i, elem);
                            };
                        }
                    });
                });
            };
        })(jQuery);

      

I've added a jQuery datepicker to the example so that you can easily change the date to observe the behavior of the progress bars.

Hope this can help anyone else who may be struggling with the progress bar

+3
javascript jquery css jquery-ui-progressbar


source to share


No one has answered this question yet

Check out similar questions:

7428
How can I check if an element is hidden in jQuery?
7205
Why does HTML consider "chucknorris" a color?
4523
Thinking in AngularJS if I have a jQuery background?
4345
How to check if a checkbox is checked in jQuery?
3952
Setting "checked" for a checkbox with jQuery?
3856
Change HTML5 placeholder color with CSS
2644
Is there a function "exists" for jQuery?
2302
Add table row in jQuery
2101
jQuery scroll to element
1957
Disable / enable input with jQuery?



All Articles
Loading...
X
Show
Funny
Dev
Pics