使用jQuery创建文本阴影的元素 [英] Animating elements of text-shadow with jQuery

查看:124
本文介绍了使用jQuery创建文本阴影的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法,使用jQuery,动画效果的文本阴影的大小或颜色的属性。

I was wondering if there was any way to, using jQuery, animate properties of text-shadow like size or colour.

这是令人讨厌的, text-shadow-color 的属性,而不是只能以组合形式提供的语句。

It's annoying that there aren't individual properties like text-shadow-color instead of the statement only being available in combined form.

推荐答案

这个答案可能晚了一点,但是在这里它总是...

Might be a little late for this answer, but here it is anyway...

我通过实现一个虚拟css属性以像这样的动画。

I solved it by implementing a "virtual" css-property to be animated like this

$.fx.step.textShadowBlur = function(fx) {
  $(fx.elem).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px black'});
};

$(el).css({textShadowBlur:20})
    .animate({textShadowBlur:1}, {duration: 1000});

这里有更详细的描述:
http://usefulthink.com/2010-12/animating-text-shadow-using-jquery

This is described in more detail here: http://usefulthink.com/2010-12/animating-text-shadow-using-jquery

其他一些方法可以在这里找到:
http://forum.jquery.com/topic/let-s-animate-text-shadow

Some other approaches can be found here: http://forum.jquery.com/topic/let-s-animate-text-shadow

这篇关于使用jQuery创建文本阴影的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆