animating an element's height using jquery

前端 未结 7 497
情书的邮戳
情书的邮戳 2021-01-26 04:56

I have some bars that are filled with a height %, but right when the page loads I would like all the bars to fill up and then decrease to 0. I know how to fill it up with a for

相关标签:
7条回答
  • 2021-01-26 05:55

    You can do it all in one loop:

    for(var i = 0; i <= 200; i++) {
        var height = (i <=100) ? i : 200 - i;
    }
    

    The variable height will go from 0 to 100 and then back to 0.

    0 讨论(0)
提交回复
热议问题