jQuery event for images loaded

后端 未结 14 1426
离开以前
离开以前 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

    As per this answer, you can use the jQuery load event on the window object instead of the document:

    jQuery(window).load(function() {
        console.log("page finished loading now.");
    });
    

    This will be triggered after all content on the page has been loaded. This differs from jQuery(document).load(...) which is triggered after the DOM has finished loading.

提交回复
热议问题