jQuery event for images loaded

后端 未结 14 1207
离开以前
离开以前 2020-11-22 15:25

Is it possible to detect when all images are loaded via a jQuery event?

Ideally, there should be a

$(document).idle(function()
{
}

14条回答
  •  孤街浪徒
    2020-11-22 15:49

    For same-origin images, you could use:

    $.get('http://www.your_domain.com/image.jpg', imgLoaded);
    
    function imgLoaded(){
        console.log(this, 'loaded');
    }
    

提交回复
热议问题