How can I trigger an event after lazy load has loaded an image?

随声附和 提交于 2019-12-04 04:22:19

found this to work:

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

Entrabiter's answer is actually for triggering a function when the image appears on screen, not after it has loaded. To run some code after an image has loaded (i.e. faded in), you need the 'load' argument:

$('img.lazy').on('load',function(){
  console.log(this)//fires this function when it appears
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!