html 页面 ajax 方法显示遮罩
showLoading.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:998;width:100%;height:100%;_padding:0 50% 0 0;background:#333333;display:none;} .showbox{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 .showbox,*html .overlay{position:absolute;top:expression(eval(document.documentElement.scrollTop));} #AjaxLoading{color:#37a;font-size:12px;font-weight:bold;} /*#AjaxLoading div.loadingWord{width:300px;height:50px;line-height:50px;border:0px solid #000000;background:#65eae6;}*/ #AjaxLoading div.loadingWord{} #AjaxLoading img{margin:10px 15px;float:left;display:inline;}
html 代码,辅助两个div
<body> <!--遮罩 开始--> <div class="overlay"></div> <div id="AjaxLoading" class="showbox"> <div class="loadingWord"><img src="/resource/jQuery.showLoading/images/loading2.gif" /></div> </div> <!--遮罩 结束--> </body>
JS代码
<script type="text/javascript"> //----判断当前页面是否加载状态 开始 ---- document.onreadystatechange = subSomething;//当页面加载状态改变的时候执行这个方法. function subSomething() { if (document.readyState != 'complete') //当页面加载状态 { //----显示遮罩 开始---- $(".overlay").css({ 'display': 'block', 'opacity': '0.8' }); $(".showbox").stop(true).animate({ 'margin-top': '300px', 'opacity': '1' }, 200);
$('#AjaxLoading').show() //----显示遮罩 结束---- } } //----判断当前页面是否加载状态 结束 ---- $(function () { jQuery.ajax({ url: 'test.ashx', type: "POST", dataType: "json", data: { "cptypeid": cptypeid, "cpnameid": cpnameid }, success: function (result) { if (result.success) { } //----隐藏遮罩 开始---- $(".showbox").stop(true).animate({ 'margin-top': '250px', 'opacity': '0' }, 400); $(".overlay").css({ 'display': 'none', 'opacity': '0' });
$('#AjaxLoading').hide()
//----隐藏遮罩 结束----
} })
})
</script>
我的小鱼你醒了,
还认识早晨吗?
昨夜你曾经说,
愿夜幕永不开启。
初吻吻别的那个季节,
不是已经哭过了吗?
你的香腮边轻轻滑落的,
是你的泪,还是我的泪。
我的指尖还记忆著,
你慌乱的心跳。
温润的体香里,
那一缕长髮飘飘。
——青青树 《魁拔》
交流群:ASP.NET交流群(2群) 58189568
ExtJs4.2交流群(3群)97869295
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
2015-01-08 EXTJS 3.0 资料 控件之 GridPanel属性与方法大全