判读图片加载完成后执行

magento 收藏
0 47
var $imgs = mas_list.find("img");
            var imgdefereds = [];
            $imgs.each(function() {
                var dfd = $.Deferred();
                $(this).bind('load',function(){
                    dfd.resolve();
                }).bind('error',function(){
                    //图片加载错误,加入错误处理
                    // dfd.resolve();
                })
                if(this.complete) setTimeout(function(){
                    dfd.resolve();
                },1000);
                imgdefereds.push(dfd);
            });
            $.when.apply(null, imgdefereds).done(function() {})


    暂时没有人评论
精选帖子
热门帖子
1在phtml中使用图片 80
2创建flutter应用 79
3js 变量命令法 78
4应用配置 78
5js 添加邮箱验证 77
6flutter 构建模式 77
7回流和重绘 77
8作用域 76
9const注意点 75