jQuery event for images loaded

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

    I created my own script, because I found many plugins to be quite bloated, and I just wanted it to work the way I wanted. Mine checks to see if each image has a height (native image height). I've combined that with the $(window).load() function to get around the issues of caching.

    I've code commented it quite heavily, so it should be interesting to look at, even if you don't use it. It works perfectly for me.

    Without further ado, here it is:

    imgLoad.js script

提交回复
热议问题