开发者

Can jQuery animate() behave differently for specific elements within my selection?

开发者 https://www.devze.com 2022-12-25 15:36 出处:网络
I have a selection of elements in a jQuery object. I want to animate their font sizes, but as I have both the headlines and various paragraphs in the selection, they should be animated slightly differ

I have a selection of elements in a jQuery object. I want to animate their font sizes, but as I have both the headlines and various paragraphs in the selection, they should be animated slightly differently, as the headlines should end up with a larger font size than the paragraphs. I already have this information stored in the jQuery data cache.

I can do that. But, not unless I use several calls to the animate function, one for each specific, slightly d开发者_Go百科ifferent animation, perhaps using event triggering or setTimeout() calls.

Of course I want to avoid this, as it's damn ugly and an odd way around. Much prettier if it could be done internally, within the animation ...

Any help would be much appreciated.


You can animate an increase in fontSize:

$(...).animate({ fontSize: '+=8' });
0

精彩评论

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

关注公众号