作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在加载正文时显示我的 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/
我想在加载正文时显示我的 div(包装器)。这是我的代码: $("div.wrapper").hide(); $('body').load(function() { $('.wrapper')
伙计们,我在我的网站上找不到执行此操作的方法。我需要一些覆盖整个网站的东西(可以是带有黑色背景的 div 或图像,等等),并且在正文加载之前出现一个问题。 用户在输入中输入答案并提交,如果答案正确(答
我是一名优秀的程序员,十分优秀!