首頁 > web前端 > js教程 > Javascript 遮罩層與載入效果程式碼_javascript技巧

Javascript 遮罩層與載入效果程式碼_javascript技巧

WBOY
發布: 2016-05-16 17:27:14
原創
978 人瀏覽過
複製程式碼 程式碼如下:

 //loading
function show show var iWidth = 120; //彈出視窗的寬度;
var iHeight = 0; //彈出視窗的高度;
var scrolltop = 0;
var scrollleft = 0;
var cheight = 00 ;
var cwidth = 0;
var eTip = document.createElement('div');
eTip.setAttribute('id', 'tipDiv');
eTip.style.position = ' absolute';
eTip.style.display = 'none';
eTip.style.border = 'solid 0px #D1D1D1';
eTip.style.backgroundColor = '#4B981D';
eTip.style.backgroundColor = '#4B981D';
eTip.style. .style.padding = '5px 15px';
if(document.body.scrollTop){//這是一個js的相容
scrollleft=document.body.scrollLeft;
scrolltop=document.body. scrollTop;
cheight=document.body.clientHeight;
cwidth=document.body.clientWidth;
}
else{
scrollleft=document.documm. .documentElement.scrollTop;
cheight=document.documentElement.clientHeight;
cwidth=document.documentElement.clientWidth;
}
iHeight = eTip.MoffsetHeight; )/2 scrollleft; //
var v_top=(cheight-iHeight)/2 scrolltop;
eTip.style.left = v_left 'px';
eTip.style.top = v_top 'px';
eTip.innerHTML = 'Javascript 遮罩層與載入效果程式碼_javascript技巧 ' tipInfo '';
try {
document.body.appendChild(eTip);
} catch (e) { }
$("#tipDiv").css("float", " right");
$("#tipDiv").css("z-index", "99");
$('#tipDiv').show();
ShowMark();
}
function closeLoad() {
$('#tipDiv').hide();
HideMark();
}
//顯示蒙灰層
function ShowMark() {
var xp_mark = document.getElementById("xp_mark");
if (xp_mark != null) {
//設定DIV
xp_mark.style.left = 0 "px ";
xp_mark.style.top = 0 "px";
xp_mark.style.position = "absolute";
xp_mark.style.backgroundColor = "#000";
xp_mark.style. zIndex = "1";
if (document.all) {
xp_mark.style.filter = "alpha(opacity=50)";
var Ie_ver = navigator["appVersion"].substr(22 , 1);
if (Ie_ver == 6 || Ie_ver == 5) { hideSelectBoxes(); }
}
else { xp_mark.style.opacity = "0.5"; }
xp_mark .style.width = "100%";
xp_mark.style.height = "100%";
xp_mark.style.display = "block";
}
else {
/ /頁面新增div explainDiv,注意必須是緊接body 內的第一個元素.否則IE6不正常.
$("body").prepend("");
ShowMark(); //繼續回呼自己
}
}
//隱藏蒙灰層
function HideMark() {
var xp_mark = document.getElementById("xp_mark");
xp_mark.style.display = "none";
var Ie_ver = navigator["appVersion"].substr(22, 1);
if ( Ie_ver == 6 || Ie_ver == 5) { showSelectBoxes(); }
}

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板