本文介绍了用.animate改变文本(html)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为标签的HTML部分设置动画效果(< font id =testsize =7> This Text!< / font> )使用jQuery的Animate函数,如下所示:

  $(#test)。delay(1500).animate({文字:'文字已经改变!'},500); 

然而没有任何反应,它不会改变文字。



我该怎么做?谢谢!

函数'签名是:

  .animate(properties,options); 

它说下面关于参数属性

text 不是CSS属性,这就是为什么该函数不能按照您的预期工作。



你想淡出文本吗?你想移动它吗?我可能会提供一个替代方案。



查看。


I am trying to animate the html part of a tag ( <font id="test" size="7">This Text!</font> ) using jQuery's Animate function, like so:

$("#test").delay(1500).animate({text:'The text has now changed!'},500);

However nothing happens, it does not change the text.

How can I do this? Thanks!

解决方案

The animate(..) function' signature is:

.animate( properties, options );

And it says the following about the parameter properties:

text is not a CSS property, this is why the function isn't working as you expected.

Do you want to fade the text out? Do you want to move it? I might be able to provide an alternative.

Have a look at the following fiddle.

这篇关于用.animate改变文本(html)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 06:57