html实现页面加载效果,jquery实现页面加载效果

1、说明

Jquery页面加载可实现异步请求时提示“请稍后,正在加载...”效果,同步请求不可用(即ajax async: false)。

2、代码

jquery页面加载特效

*

{

margin: 0;

padding: 0;

list-style-type: none;

}

a, img

{

border: 0;

}

.loading

{

margin: 100px auto 0 auto;

width: 400px;

text-align: center;

font-size: 18px;

}

.loading .action

{

text-decoration: none;

font-family: "微软雅黑" , "宋体";

}

.cover

{

position: fixed;

top: 0;

right: 0;

bottom: 0;

left: 0;

z-index: 998;

width: 100%;

height: 100%;

_padding: 0 20px 0 0;

background: #f6f4f5;

display: none;

}

.showLoad

{

position: fixed;

top: 0;

left: 50%;

z-index: 9999;

opacity: 0;

filter: alpha(opacity=0);

margin-left: -80px;

}

*html, *html body

{

background-image: url(about:blank);

background-attachment: fixed;

}

*html .showLoad, *html .cover

{

position: absolute;

top: expression(eval(document.documentElement.scrollTop));

}

#ajaxLoad

{

border: 1px solid #8CBEDA;

font-size: 12px;

font-weight: bold;

}

#ajaxLoad div.loadAll

{

width: 180px;

height: 50px;

line-height: 50px;

border: 2px solid #D6E7F2;

background: #fff;

}

#ajaxLoad img

{

margin: 10px 15px;

float: left;

display: inline;

}

$(function () {

var hei = $(document).height();

$(".cover").css({ "height": hei });

$(".action").click(function () {

startWaiting();

setTimeout(function () {

endWaiting();

}, 3000);

});

});

//开始加载

function startWaiting() {

$(".cover").css({ 'display': 'block', 'opacity': '0.8' });

$(".showLoad").stop(true).animate({ 'margin-top': '300px', 'opacity': '1' }, 200);

}

//结束加载

function endWaiting() {

$(".showLoad").stop(true).animate({ 'margin-top': '250px', 'opacity': '0' }, 400);

$(".cover").css({ 'display': 'none', 'opacity': '0' });

}

waiting.gif加载中,请稍候...

f63495004e530cddf43c114e71f00e06.png

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值