首页 > 移动平台 > 详细

append2 给append 添加回调方法

时间:2014-08-22 19:32:39      阅读:445      评论:0      收藏:0      [点我收藏+]
   $.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 添加回调方法

原文:http://www.cnblogs.com/hun_dan/p/3930041.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!