Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how to check if a same domain, dynamically loaded iframe which i have no control over is 100% loaded?
- function callIframe(url, callback) {
- $(document.body).append('<IFRAME id="myId" ...>');
- $('iframe#myId').attr('src', url);
- $('iframe#myId').load(function()
- {
- callback(this);
- });
- }
- $(".post_relative").each(function () {
- var post_relative = $(this);
- var photoset = post_relative.find('.html_photoset');
- if(photoset.length){
- var myFrame = photoset.find("iframe");
- myFrame.load(function(){
- var newCover=myFrame.contents().find('.photoset').children(':first-child').children(':first-child').attr("href")+ '?'+(Math.random()*10000);
- post_relative.append("<img src='"+ newCover +"' alt='Cover Page' />");
- var psHeight = post_relative.find('img');
- psHeight.load(function(){
- if (psHeight.height()>heightRef){
- psHeight.height(heightRef);
- }
- myFrame.hide();
- })
- })
- }
- });
- $("#iFrameId").load(function (){
- // do something once the iframe is loaded
- });
Add Comment
Please, Sign In to add comment