在所有javascript任务上使用动画

Pro*_*XYZ 5 html javascript jquery animation jquery-animate

我有一个项目,我正在进行许多javascript dom html分配,例如:

this.firstChild.nodeValue = "example";
document.getElementById('id').innerHTML = "example";
Run Code Online (Sandbox Code Playgroud)

到处都有大量的,并非所有都是一样的.我希望它是每当我为html分配值/输出时,它使用jquery animate"淡入".

这甚至可以不经过每个任务并手动完成吗?

谢谢.

Mad*_*dan 0

你为什么不尝试使用函数,传递参数。

function animate(value, dom){
    dom.firstChild.nodeValue = value;
    document.getElementById('id').innerHTML = value;
    $(dom).fadeIn();
}
Run Code Online (Sandbox Code Playgroud)