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 });

 

posted @ 2020-04-08 11:18  科技改变未来☆  阅读(287)  评论(0编辑  收藏  举报