html页面载入完毕返回顶部,javascript – 加载完成后显示HTML页面

最简单的做法是在主体中放置一个带有以下CSS的div:

#hideAll

{

position: fixed;

left: 0px;

right: 0px;

top: 0px;

bottom: 0px;

background-color: white;

z-index: 99; /* Higher than anything else in the document */

}

(注意位置:固定将不工作在IE6 – 我知道没有肯定火的方式在这个浏览器)

添加DIV像这样(直接在开始body标记之后):

直接显示DIV:

document.getElementById("hideAll").style.display = "block";

并隐藏它onload:

window.onload = function()

{ document.getElementById("hideAll").style.display = "none"; }

或使用jQuery

$(window).load(function() { document.getElementById("hideAll").style.display = "none"; });

这种方法的优点是它也适用于关闭JavaScript的客户端。它不应该导致任何闪烁或其他副作用,但没有测试它,我不能完全保证它的每个浏览器。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值