开发者

JQuery function execute when all images are loaded

i need to execute a function when all images within a document are fully loaded i have try this


$(window).load(function() {....})

but this is not working properly in opera browser any other function that detect all images are loaded and also ignore if there is a missing 开发者_Python百科image


According to http://api.jquery.com/load-event/, you will want to bind the load event to the document and not the window. The load event will be fired for an object when all of its content and sub elements have been loaded. All of the page's content is part of the document object, and not window.

So to handle the event when all images on a page have loaded, do this:

$(document).load(function() {});

To handle the event when all images within a portion of the page have loaded, do this:

$("#pageSubSection").load(function() {});


try $(document).load(function() {....});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜