html5监控某个dom变化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html5监控某个dom变化相关的知识,希望对你有一定的参考价值。

 var targetSecondNode = $(".secondList")[0];//要监控的dom对象
    var obSecondServer = new MutationObserver(function (mutations) {
       //dom变化回调的函数
$(".secondList .item-list div:first").addClass("active"); $(".secondList .item-list div:first").click(); }); obSecondServer.observe(targetSecondNode, { attributes: true, childList: true, subtree: true });

 

以上是关于html5监控某个dom变化的主要内容,如果未能解决你的问题,请参考以下文章