开发者

Everything in an IFrame Loaded event

Is there some sort of event for IFrames that only fires when every resource (script, image, stylesheet, dom) has loaded? Basically I want to开发者_如何学运维 have a loading graphic displayed over the IFrame and only remove that when everything is loaded inside so the user doesn't see everything loading.

Currently I am using $(iframe).ready(function() { ... }); but this fires very early before anything has loaded.


You are looking for the window.onload event.

window.onload fires if anything (images, iFrames, etc.) was completly loaded, that is why most guys dislike this event pretty much. But in your case, it seems to fit.

$(window).load(function(){
   alert('fired');
});

non-jQuery

window.onload = function(){
   alert('fired');
};
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜