📜  淡出后删除 elment javascript - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:51.127000             🧑  作者: Mango

代码示例1
function removeFadeOut( el, speed ) {
    var seconds = speed/1000;
    el.style.transition = "opacity "+seconds+"s ease";

    el.style.opacity = 0;
    setTimeout(function() {
        el.parentNode.removeChild(el);
    }, speed);
}

removeFadeOut(document.getElementById('test'), 2000);