gpt4 book ai didi

jquery - 脚本未在页面加载时执行

转载 作者:太空宇宙 更新时间:2023-11-03 20:18:06 24 4
gpt4 key购买 nike

在刷新页面后显示消息可以通过以下方式完成:

HTML(插入 BODY 标签中的任意位置):

<div id="dvLoading"></div>

CSS:

#dvLoading {
background:url(../theImages/loader.gif) no-repeat center center;
height: 100px;
width: 100px;
position: fixed;
left: 50%;
top: 50%;
margin: -25px 0 0 -25px;
z-index: 9999999999999999;
}

JQuery:

$(window).bind("load", function() {
$('#dvLoading').fadeOut(2000);
});

唯一的问题是,它可以在 IE 中运行,但不能在 FF 或 Chrome 中运行。加载程序图像会在几秒钟后消失,但在 FF 和 Chrome 中,图像只是停留在原处,不会消失。

最佳答案

以标准的 jQuery 方式连接它应该适用于所有浏览器:

$(function () {
$('#dvLoading').fadeOut(2000);
});

或者,如果您没有在无冲突模式下使用 jQuery,

jQuery(function () {
$('#dvLoading').fadeOut(2000);
});

关于jquery - 脚本未在页面加载时执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16701865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com