开发者

JQuery function execute when all images are loaded

开发者 https://www.devze.com 2023-02-19 02:20 出处:网络
i need to execute a function when all images within a document are fully loaded i have try this $(window).load(function() {....})

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

精彩评论

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

关注公众号