如何在延迟加载图像后触发事件?

thi*_*ier 7 jquery jquery-lazyload

我有需要绝对定位的图像,以便图像的中心位于其父div的中心.我已经有了执行此操作的代码.

我最近添加了Lazy Load插件,它按预期工作.但是我需要一种延迟加载加载淡入图像触发我的图像居中代码的方法.

我目前的代码基本上是这样的:

jQuery(document).ready( function($) {

// Make all lazy images ready to load themselves and listen for a custom event
$("img.lazy").lazyload({ event:"delayed-lazy-load-event", effect : "fadeIn"});

});


// Wait for the iframes and other important junk to finish loading
jQuery( window ).load( function($){

// trigger lazy loading of thumbnails.
$("img.lazy").trigger("delayed-lazy-load-event")
}
Run Code Online (Sandbox Code Playgroud)

我找不到任何关于Lazy Load的任何功能的信息,它允许我设置一个回调函数在运行fadeIn效果后运行.

Ent*_*ter 10

发现这个工作:

$('img.lazy').on('appear',function(){
  console.log(this)//fires this function when it appears
});
Run Code Online (Sandbox Code Playgroud)