function ShowLoading() {
var img = $("<img id=\"progressImgage\" src=\"/images/loading.gif\" />"); //Loading小图标
var mask = $("<div id=\"maskOfProgressImage\"></div>").addClass("mask").addClass("hide"); //Div遮罩
var PositionStyle = "fixed";
var aimDiv = undefined;//可做为参数传递,有将只遮盖div
//是否将Loading固定在aimDiv中操作,否则默认为全屏Loading遮罩
if (aimDiv != null && aimDiv != "" && aimDiv != undefined) {
$(aimDiv).css("position", "relative").append(img).append(mask);
PositionStyle = "absolute";
}
else {
$("body").append(img).append(mask);
}
img.css({
"z-index": "2000",
"display": "none"
})
mask.css({
"position": PositionStyle,
"top": "0",
"right": "0",
"bottom": "0",
"left": "0",
"z-index": "1000",
"background-color": "#000000",
"display": "none"
});
img.show().css({
"position": PositionStyle,
"top": "40%",
"left": "50%",
"margin-top": function () { return -1 * img.height() / 2; },
"margin-left": function () { return -1 * img.width() / 2; }
});
mask.show().css("opacity", "0.1");
}
看了一位博友的文章,挺好用的