Reputation: 451
I need your help making this progress bar animate starts from 0 to now value I have tried jquery code for an hour but the animation didn't behave the way it should be. Need your help guys. Thank you in advance.
import $ from 'jquery';
import ProgressBar from 'react-bootstrap/ProgressBar';
function ProgressBar() {
var delay = 1500;
$(".progress-bar").each(function(){
$(this).animate( { width: $(this).attr('aria-valuenow') + '%' }, delay );
});
return (
<ProgressBar className="ProgressBar" now={95} />
<ProgressBar className="ProgressBar" now={55} />
<ProgressBar className="ProgressBar" now={50} />
);
}
export default ProgressBar;
Upvotes: 1
Views: 182
Reputation: 128
You can make use of animated
props. I think that would suffice. Attaching a codesandbox for clarity.
https://codesandbox.io/s/upbeat-diffie-ghizg?file=/src/App.js
Upvotes: 2