jQuery如何使用效果更改div的文本值 [英] Jquery how to change text value of div with an effect

查看:225
本文介绍了jQuery如何使用效果更改div的文本值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用以下代码在div内进行更改

I am able to change inside of div with the following code

$(".mydivclass").html("my data");

现在,如果可能的话,我想添加一个效果,如表演(延迟)或其他.当更改div中的数据时,我该怎么做.谢谢

Now if possible i want to add an effect like show (delay) or something other. How can i do that when changing the data inside div. Thank you

推荐答案

使用褪色效果的简单示例.

A little simple example using fading effect.

HTML

<div id="sometext">
    Start text 
</div>

JS

$("#sometext").fadeOut(function() {
  $(this).text("change!").fadeIn();
});

拨弄: http://jsfiddle.net/uxhE2/

这篇关于jQuery如何使用效果更改div的文本值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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