如何在页面加载之前将加载消息放入iframe [英] how to put loading message in iframe before page was loaded
本文介绍了如何在页面加载之前将加载消息放入iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个链接,当鼠标悬停在其上时,它的content(src)将被加载到iframe中.我想在页面完全加载之前在iframe中显示加载消息.可以留言吗
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. Is it possible to put that message
下面是jsfiddle http://jsfiddle.net/sukumar/tSwC6/3/
Below is jsfiddle http://jsfiddle.net/sukumar/tSwC6/3/
关于. 苏库玛(Sukumar)
Regards. Sukumar
推荐答案
您可以使用以下内容:
$("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();
}
);
这篇关于如何在页面加载之前将加载消息放入iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文