function toggle(){
$("#tempc").toggle(
function () {
$("#tempc").animate({width: 255, height: 220}, 1000);
$("#tempc").html("");
$("#tempc").css("background-color", "transparent");
$("#tempc").html("<iframe src='/src/stream.php?stream=1' width='255' height='225' frameborder='0' scrolling='no'></iframe><br><a href='javascript:;' onclick='hidegadget();' class='yellowblock'>Sluit</a>");
},
function () {
$("#tempc").animate({width: 50, height:50}, 1000);
$("#tempc").html("");
$("#tempc").css("background-color", "#FFFF00");
$.get('src/stream.php?stream=2', function(data002) {
$('#tempc').html(data002);
});
}
);
}
$.get('src/stream.php?stream=2', function(data002) {
$('#tempc').html(data002);
});
Hello stackoverflow,
不久之前,我试图为div设置动画,好吧,它现在只有一件事.
第一个函数被激活时(从第3行开始),iframe被加载.但是现在,我怎么能预加载那个iframe?因为动画结束时iframe没有加载…
问候
解决方法:
使用JQuery,您不需要使用iframe.看一下.load()函数. http://api.jquery.com/load
即
$('#tempc').load('src/stream.php?stream=1');
要预加载页面,只需创建一个隐藏的div并在准备好时显示它.
var stream2 = $('<div>').load('src/stream.php?stream=2').hide();
$('#tempc').html(stream2.html());
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。