Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
142
rated 0 times [  144] [ 2]  / answers: 1 / hits: 63718  / 10 Years ago, fri, may 9, 2014, 12:00:00

I want to animate a progress bar's width from 0% to 70% over 2.5 seconds. However, the code below immediately changes the width to 70% after a 2.5 second delay. What am I missing?



$(.progress-bar).animate({
width: 70%
}, 2500);


JSFiddle: http://jsfiddle.net/WEYKL/


More From » jquery

 Answers
40

The problem is in default Bootstrap transition effect, which animates any update of the width property.



If you switch it off with supressing the corresponding style, it will work fine, e.g.:



.progress-bar {
-webkit-transition: none !important;
transition: none !important;
}


DEMO: http://jsfiddle.net/WEYKL/1/


[#71103] Thursday, May 8, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
makaylahk

Total Points: 166
Total Questions: 94
Total Answers: 117

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
;