开发者

Get width and height during animation state

开发者 https://www.devze.com 2023-02-22 14:49 出处:网络
I\'m just wondering if it is possible to get the width and height of an element during animation state where height and width are animated? I\'m using CSS3 to accomplish the animation. and I want to g

I'm just wondering if it is possible to get the width and height of an element during animation state where height and width are animated? I'm using CSS3 to accomplish the animation. and I want to get it every 10 millisecond?

#animElement{
    -webkit-transition: width 1s, height 1s;
}

My javascript code is little bit wrong, could you take a look at it to? I'm testing to write the number i every 10 millisecond. I'm just testing this code for using it to get the width and height later.

for(var i=0;i<1000;i++){
    (function(num){
        window.setTimeout(function(){$('#flyingSquare').html(num);}, 1开发者_C百科0);
    })(i);
}

It wirtes the number 1000 directly which is wrong. It should count to 100 instead.


If you use JavaScript to do the animation you can more easily.

0

精彩评论

暂无评论...
验证码 换一张
取 消