首页 > 代码库 > append2 给append 添加回调方法

append2 给append 添加回调方法

   $.fn.append2 = function(html, callback) {        var originalHtmlLength = $("body").html().length;        this.append(html);        var nums = 1;        var timer1 = setInterval(function() {            nums++;            var clearIntervalfun = function() {                clearInterval(timer1)                callback();            }             var flag = originalHtmlLength != $("body").html().length || nums > 1000;            // console.info("append html expend {0}ms".format(nums))            flag && clearIntervalfun()        }, 1)    };

 

append2 给append 添加回调方法