遮罩层

jquery-1.8.1.min.js
//框框
<div class="overlay"></div>
<div id="AjaxLoading" class="showbox"style="display:none;">
  <div class="loadingWord"><img src="<?php echo Yii::$app->params['staticUrl']; ?>/assets/img/load-16-16.gif">请求中,请稍候  <span class="clockd">  60 </span> 秒 </div>
</div>
//样式
<style type="text/css">
  *{margin:0;padding:0;list-style-type:none;}
  a,img{border:0;}
  .overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999;width:100%;height:100%;_padding:0 20px 0 0;background:#f6f4f5;display:none;}
  .showbox{position:fixed;top:0;left:50%;z-index:99999;opacity:0;filter:alpha(opacity=0);margin-left:-80px;}
  *html,*html body{background-image:url(about:blank);background-attachment:fixed;}
  *html .showbox,*html .overlay{position:absolute;top:expression(eval(document.documentElement.scrollTop));}
  #AjaxLoading{border:1px solid #8CBEDA;color:#37a;font-size:12px;font-weight:bold;}
  #AjaxLoading div.loadingWord{width:200px;height:50px;line-height:50px;border:2px solid #D6E7F2;background:#fff;}
  #AjaxLoading img{margin:10px 15px;float:left;display:inline;}
</style>
var pageTimer = {}; //定义计算器全局变量
//打开
function ShowLoading() {
    $(".showbox").css({ 'display': 'block', 'opacity': '0.8' });
    $(".overlay").css({ 'display': 'block', 'opacity': '0.8' });
    $(".showbox").stop(true).animate({ 'margin-top': '300px', 'opacity': '1' }, 200);
    var i = 60;
    pageTimer["timer"]  = setInterval(function(){
      if(i== -1){
          clearInterval(pageTimer["timer"]);
      }else{
          $(".clockd").html(i);
          --i;
      }
    },1000);
}
//关闭
function HiddenLoading() {
    $(".clockd").html('60');
    for(var each in pageTimer){
      clearInterval(pageTimer[each]);
    }
    $(".showbox").css({ 'display': 'none', 'opacity': '0.8' });
    $(".showbox").stop(true).animate({ 'margin-top': '250px', 'opacity': '0' }, 400);
    $(".overlay").css({ 'display': 'none', 'opacity': '0' });
}

 

可将代码放置公共文件中  方便页面调用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值