Is there a way to have a bootstrap progress bar animate when increasing in value, but not when resetting to 0%? ( self.jquery ) submitted 3 years ago * by Bumblebeeg. JQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.
If I have a bootstrap progress bar that cycles from 0% to 100%, and back to 0% relatively quickly, by the time the 'reset to 0%' animation finishes, the new value is already around 40%, so the resulting effect makes the progress bar look as though it's bouncing between 40% to 100% to 40% to 100%, etc. Is there any way to have the progress bar animate when increasing its value, but to make a discrete 'jump' when resetting to 0%?
If not, is there another way that I can achieve the same effect? Edit #1: Here's a Edit #2: I've solved the problem using AngularJS and ng-class. Is the solution that I came up with. This got me part of the way there. Since I'm using AngularJS, however, including jQuery in the controller is not very good practice so I have to include it in a directive.
This means I might need to find a way to somehow listen for a CSS change or something to that effect. Is a jsfiddle example showing what I mean. I realize this is the jQuery subreddit, so you can just ignore the AngularJS bits if needed. I have your code hooked up to a 'mousemove' event for the time being, so you can see the expected behaviour.
Simply keep moving the cursor over the progress-bar, and you should see the bar jump back to 0% once the counter reaches 100. Hopefully this should be sufficient to illustrate what I'm trying to achieve. Edit: I actually found a much cleaner way of getting the job done using ng-class. Is the example.
A slight modification of from your example then adding to.progress-container: -webkit-transform-origin: 0 100%; -webkit-transform: rotate(90deg) scaleX(-1) translate(-100%,-50%); -moz-transform-origin: 0 100%; -moz-transform: rotate(90deg) scaleX(-1) translate(-100%,-50%); -ms-transform-origin: 0 100%; -ms-transform: rotate(90deg) scaleX(-1) translate(-100%,-50%); transform-origin: 0 100%; transform: rotate(90deg) scaleX(-1) translate(-100%,-50%); would convert the progress bar from horizontal to vertical starting from bottom. Rotate(90deg) did the rotating trick, scaleX(-1) reverse the position 180 degree, translate(-100%,-50%) fix the position as it should be before reversed 180 degree. See snippet for example.