gpt4 book ai didi

jquery - 检查 body 负荷(或其他要素)

转载 作者:行者123 更新时间:2023-12-03 22:59:54 25 4
gpt4 key购买 nike

我想在加载正文时显示我的 div(包装器)。这是我的代码:

$("div.wrapper").hide();
$('body').load(function() {
$('.wrapper').show();
});

但是我的代码不起作用。我的错误是什么?

最佳答案

描述

.ready() Specify a function to execute when the DOM is fully loaded.

因此,使用 css 使您的 div 不可见,并使用 jQuery 使其可见。

示例

HTML

<div class="wrapper" style="display:none">
<!-- your content -->
</div>

jQuery

$(document).ready(function() {
$('.wrapper').show();
});

完整示例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>

<script type="text/javascript" src="PathToYourJqueryJsFile" />
<script type="text/javascript">
$(document).ready(function () {
$('.wrapper').show();
});
</script>
</head>
<body>
<div class="wrapper" style="display:none">
<!-- your content -->
</div>
</body>
</html>

更多信息

关于jquery - 检查 body 负荷(或其他要素),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8837242/

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