jQuery animate and property values in percentage

后端 未结 6 1777
孤城傲影
孤城傲影 2020-12-02 00:03

I trying to animate a div and I try to use some value retreived somewhere else, I know the value to be correct because I\'ve printed out the output... so I\'m wondering why

6条回答
  •  失恋的感觉
    2020-12-02 00:16

    This works if you're happy using CSS3 transitions:

    JS:

    function animateBar(percentage){
        $('#innerBox').width(percentage+'%');
    }
    

    CSS:

    #innerBox{transition: 3s}
    

提交回复
热议问题