【发布时间】:2019-02-08 02:37:12
【问题描述】:
在使用 inner.HTML 时寻找淡入内容。
当前代码;
<td style="width: 20%;" class="responsive-td" valign="top">
<div id="placeholder1" class="placeholder1" style="color:white;"></div>
</td>
if (//logic here){
document.getElementById('placeholder1').innerHTML ='add this with fading effect';
setTimeout(addFn1, 300);
function addFn1() {
document.getElementById('placeholder2').innerHTML ='add this with fading effect';}
setTimeout(addFn2, 1200);
function addFn2() {
document.getElementById('placeholder3').innerHTML ='add this with fading effect';}
}
我尝试使用 css,但由于 setTimeout,它没有创建效果。
有没有使用 CSS 或 JS 的简单解决方案?或者如果需要的话,甚至是 jQuery?
【问题讨论】:
-
也许你可以尝试在更改文本时使用
opacity设置为 old=zero 到 new=one
标签: javascript jquery css innerhtml