jQuery animate“text-shadow” css属性 [英] jQuery animate "text-shadow" css property

查看:315
本文介绍了jQuery animate“text-shadow” css属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我已经使用jQuery的 .animate()方法,我知道,为了使左边距的动画,你必须使用这样的东西:

  $('#thing')。animate({marginLeft:20},1000); 

这不同于使用css属性 margin-left:20px;



如何使用中的 text-shadow animate()

解决方案

CSS转换是最好的方式,



在这种情况下,您只需设置过渡属性,然后使用JS或更改类来更改样式。 / p>

基本示例: http://jsfiddle.net/adZ42/1/



有关将此更改为jQuery的更多信息: http:// css3。 bradshawenterprises.com/legacy/


So as i've worked with jQuery's .animate() method i've learned that in order to animate the left margin you would have to use something like this:

$('#thing').animate({marginLeft: 20}, 1000);

Which is different than using the css property margin-left: 20px;

How could I use the text-shadow property inside animate() ?

解决方案

CSS transitions are the best way for this, as every browser in common usage that supports text-shadow also supports transitions.

In that case, you just set the transition properties, then change the style either with JS or by changing the class.

Basic example: http://jsfiddle.net/adZ42/1/

More info on retrofitting this into jQuery: http://css3.bradshawenterprises.com/legacy/

这篇关于jQuery animate“text-shadow” css属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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