监听dom

作者: 红酒煮咖啡 | 来源:发表于2023-07-12 14:29 被阅读0次

    let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
    const mutation = new MutationObserver(function(mutationRecoards, observer) {
    })
    // 对观察者添加需要观察的元素,并设置需要观察元素的哪些方面
    mutation.observe(document.getElementsByTagName('body')[0], {
    attributes: true,
    childList: true,
    });

    https://blog.csdn.net/qq_35385241/article/details/121989261

    相关文章

      网友评论

          本文标题:监听dom

          本文链接:https://www.haomeiwen.com/subject/wslpudtx.html