Jquery 页面加载时加载/fadein HTML在IE 7&;中不起作用;8.
以下代码适用于safari、firefox、IE9和chrome,但在IE8和IE7中,它只显示加载的图像,并且在包含所有内容的.wrap中从不褪色。有什么不对劲吗 这在documentready函数中,但即使我将其移出,它也无法工作Jquery 页面加载时加载/fadein HTML在IE 7&;中不起作用;8.,jquery,internet-explorer-8,internet-explorer-7,Jquery,Internet Explorer 8,Internet Explorer 7,以下代码适用于safari、firefox、IE9和chrome,但在IE8和IE7中,它只显示加载的图像,并且在包含所有内容的.wrap中从不褪色。有什么不对劲吗 这在documentready函数中,但即使我将其移出,它也无法工作 $(window).on('load', function() { var firstBackgroundImage = new Image(); firstBackgroundImage.s
$(window).on('load', function() {
var firstBackgroundImage = new Image();
firstBackgroundImage.src = "img/bg-img.jpg";
firstBackgroundImage.onload = function () {
$('#loading-image').hide();
$(".wrap").fadeIn(300);
loadContent();
};
});
CSS
文档中的窗口加载事件准备好了吗?您不需要同时指定这两个选项;只需使用文档就绪
将两者放在一起很容易导致奇怪的结果。文档中的窗口加载事件准备好了吗??您不需要同时指定这两个选项;只需使用文档就绪。两者都在一起很容易导致奇怪的结果。是的,这很有效,谢谢!伟大的我会将其作为答案发布,以便您可以接受它。:-)
.wrap{
height: 678px;
background: url("../img/bg-img.jpg") no-repeat scroll 0 0 transparent;
margin-top:18px;
padding-top:1px;
position:relative;
display:none;
}