第一步:添加遮罩层和LOADING层

<div class="overlay"></div>
<div id="AjaxLoading" class="showbox">
 <div class="loadingWord"><img src="../JS/waiting.gif">加载中,请稍候...</div>
</div>

第二步:添加CSS样式

<style type="text/css">
    *{margin:0;padding:0;list-style-type:none;}
    a,img{border:0;}
    .demo{margin:100px auto 0 auto;width:400px;text-align:center;font-size:18px;}
    .demo .action{color:#3366cc;text-decoration:none;font-family:"微软雅黑","宋体";}
    .overlay{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;}
    .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{border:1px solid #8CBEDA;color:#37a;font-size:12px;font-weight:bold;}
    #AjaxLoading div.loadingWord{width:180px;height:50px;line-height:50px;border:2px solid #D6E7F2;background:#fff;}
    #AjaxLoading img{margin:10px 15px;float:left;display:inline;}
    </style>

第三步:添加JS控制代码

<script>

$(document).ready(function () {

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

$(".overlay").css({ "height": h });

$("#btn3").click(function () {

ShowLoading();

$.post("../ASHX/Course.ashx", { json: s, cid: "1234567" }, function (data, textStatus) {

alert(data + " status:" + textStatus);

HiddenLoading();

})

})

function ShowLoading() {

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

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

}

function HiddenLoading() {

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

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

}

});

</script>

JQuery实现页面Loading效果的更多相关文章

  1. 页面loading效果

    当网页太大,打开太慢的时候,为了增加良好的用户体验(不让用户眼巴巴的等,心中暗骂c,这么慢),我们需要加一个等待动画. 只需把以下代码加入页面中即可,图片可以根据自己的需求更换,更换图片之后需要改变l ...

  2. jquery mobile页面切换效果(Flip toggle switch)(注:jQuery移动使用的数据属性的列表。 )

    1.页面切换(data-transition)

  3. 前端页面loading效果(CSS实现)

    当首页内容或图片比较多时,加载时间会比较长,此时可能出现页面白屏的情况,用户体验较差.所以,在页面完全加载出来之前,可以考虑加入loading效果,当页面完全加载完后,是loading消失即可. 1. ...

  4. 基于jquery实现页面loading加载效果

    实现loading 加载提示 ······ 透明遮罩 居中效果 具体代码如下: CSS样式部分: <style type="text/css"> .background ...

  5. vue实战之狗血事件:页面loading效果诡异之事

    接上回 想加一个切换路由时,跳出一个loading动画 ,路由加载后就消失 先做了一个loading提示的浮动层的组件,全局注册,在几个路由页面都引入 在vuex里面维护一个变量比如isLoading ...

  6. [Jquery]tab页面切换效果

    思路:取得头部和内容的div,头部当前点击的高亮,其余的去除高亮,并通过index()方法获得当前点击的索引,然后内容div通过.eq(index)显示和隐藏 优化:当前做法,从第一个快速移到最后一个 ...

  7. appcloud 加载第三方页面loading效果

    apiready = function() { var header = $api.byId('header'); $api.fixIos7Bar(header); var headerPos = $ ...

  8. HTML5+jquery整屏页面切换效果

    压缩包下载 演示地址 http://www.yyyweb.com/demo/page-transitions/

  9. JQuery浮动层Loading页面加载特效

    之前做项目,经常需要一些浮动层加载Loading. 现在好多前端框架都能实现了,最常用的就是 artDialog 下面记录下当时的代码. <!DOCTYPE html PUBLIC " ...

随机推荐

  1. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.4.4

    (1). There is a natural isomorphism between the spaces $\scrH\otimes \scrH^*$ and $\scrL(\scrH,\scrK ...

  2. 6、四大组件之二-Service初步

    一.什么是Service 有些用时比较长得操作我们希望他在后台运行 ,不耽误我们当前的操作 . 这就引入了Service概念 . 常见的比如:访问网络 , 文件IO操作 , 大数据的数据库任务,播放音 ...

  3. POJ2104 K-th Number 划分树 模板题啊

    /*Source Code Problem: 2104 User: 96655 Memory: 14808K Time: 1282MS Language: G++ Result: Accepted S ...

  4. [转]VPN服务器配置详解

    借助VPN,企业外出人员可随时连到企业的VPN服务器,进而连接到企业内部网络.借助windows2003的“路由和远程访问”服务,可以实现基于软件的VPN. VPN(Virtual Private N ...

  5. cloudera manager 及CDH卸载

    记录用户数据路径 删除用户数据 中列出的用户数据路径 /var/lib/flume-ng /var/lib/hadoop* /var/lib/hue /var/lib/navigator /var/l ...

  6. NOIP2006 能量项链

    洛谷1063 能量项链 本题地址:http://www.luogu.org/problem/show?pid=1063 题目描述 在Mars星球上,每个Mars人都随身佩带着一串能量项链.在项链上有N ...

  7. 转载:MATLAB画图常用调整代码

    %单y轴 plot(t*1e+,abs(iGG)/max(abs(iGG)),); axis([-,,,]) xlabel('时间/ns'); ylabel('幅度/a.u.'); ,'FontNam ...

  8. cocos2d-x在NDK r9下的编译问题

    :69: error: format not a string literal andno format arguments [-Werror=format-security]cc1plus.exe: ...

  9. 【组队训练】2015-2016 ACM-ICPC, NEERC, Southern Subregional Contest

    好多oj都崩掉了,于是打了cf.. 开始开的最后一题...尼玛题好长终于看完了...神题不会.... I过了好多人..看了下,一眼题...随便敲了下,1A ]; int main(){ int n, ...

  10. jQuery-menu-aim有時候不能觸發BUG解決辦法

    在使用jQuery-menu-aim菜單時有時候鼠標移上去會發現樣式有改變但是第二階菜單卻沒有出現的問題 解決辦法:在exitMenu的方法中加入return true; 如下所示: exitMenu ...