Skip to content Skip to sidebar Skip to footer

How To Put Loading Message In Iframe Before Page Was Loaded

I had a link and when mouse is hovered over it, it's content(src) will be loaded in iframe. I want to display loading message in iframe before the page get's loaded completely. I

Solution 1:

What you can do is hide the iframe and put a loading icon on #content, then when it is done with loading show the iframe again with using the onload event:

http://jsfiddle.net/jeffreydev/tSwC6/4/


Solution 2:

you can use something like this:

$("a").hover(function(){

  var href = $("a").attr("href");
  var loading = $('<div>loading....</div>').appendTo("#content");
  var iframe = $("<iframe src='"+href+"'>").appendTo("#content").hide().bind('onload',   
    function(){loading.hide(); iframe.show()});
 },                
 function(){
   $("#content").empty();
 }
);

Post a Comment for "How To Put Loading Message In Iframe Before Page Was Loaded"