我有需要绝对定位的图像,以便图像的中心位于其父 div 的中心。我已经有执行此操作的代码。
我最近添加了延迟加载插件,它按预期工作。但我需要一种触发图像居中代码的方法after延迟加载已加载and图像淡入。
我当前的代码基本上是这样的:
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")
}
我找不到有关延迟加载的任何功能的任何信息,该功能允许我设置回调函数以在运行 fadeIn 效果后运行。
发现这个有效:
$('img.lazy').on('appear',function(){
console.log(this)//fires this function when it appears
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)