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

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

问题描述

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



这是令人讨厌的, / div>

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



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

  $。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



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


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

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...

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});

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

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

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

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