我尝试在div中加载PPT,同时将replaceWith与谷歌文档一起使用,如下所示:
$("#u1").click(function() {
$(".cuerpo").replaceWith('<div class="cuerpo">' + '<iframe src="http://docs.google.com/gview?url=http://**************.pptx&embedded=true" style="width:600px; height:500px;" frameborder="0"> </iframe>' + "</div>");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
问题是需要几秒钟才能完全加载,我需要显示一些div正在加载的消息,是否有其他方法?
最佳答案
使用jQuery加载的回调方法,如下所示:
$('iframe').load(function(){
// Iframe has been loaded...Do whatever you want.
});