加载时添加一个遮罩层

js代码

<script type="text/javascript">

$(function() {
var left = $(document).width() / 2 - 300 / 2;
$(".zzc").css("margin-left", left);
$(".zzc").css("margin-top", 50);

$(".zzcMain").css("width", $(document).width());
$(".zzcMain").css("height", $(document).height());
});
</script>

css代码:

<style type="text/css">

.zzcMain {
position: fixed;
display: none;
}

.zzc {
140px;
height: 33px;
border: 0px solid gray;
position: fixed;
}

.zzc>span {
color: blue;
font-size: 14px;
line-height: 35px;
}

</style>

body中添加的html代码:

<div class="zzcMain">
<div class="zzc">
<i class="fa fa-2x fa-spinner fa-spin"></i>&nbsp;<span>正在查询,请稍候...</span>
</div>
</div>

持行提交表单时的js代码:

function pFn(tjrq) {
$(".zzcMain").show();
$("#tjrqForm").submit();
}

原文地址:https://www.cnblogs.com/rdchen/p/11136558.html