Animate background color like a progress bar in jQuery

前端 未结 11 2177
南笙
南笙 2021-02-05 23:11

I have a div which has some text content( eg: My Name ) and the div is in RED background colour

11条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 23:50

    Any particular reason you want to do this in jQuery as opposed to css3?

    Bootstrap has a pretty nifty way of achieving this -> http://getbootstrap.com/components/#progress-animated

    The .progress-bar class has a css3 transition set on the width property, so as you move between 0% & 100%, any updates to the width are smoothly animated. It also uses a css3 animation to animate the background gradient (striped pattern).

提交回复
热议问题