jQuery 图片加载成功调用指定执行方法

页面中总有一些操作是,需要图片加载完之后去做的,下面的代码可实现,需要的拿走

1
2
3
4
5
6
$("img").one("load", function(v) {
// 逻辑处理
$(v.target).parent().parent().find('.over-shade').css({'height':$(v.target).height()});
}).each(function() {
if(this.complete) $(this).load();
});