>  기사  >  웹 프론트엔드  >  Javascript 마스크 레이어 및 로딩 효과 code_javascript 기술

Javascript 마스크 레이어 및 로딩 효과 code_javascript 기술

WBOY
WBOY원래의
2016-05-16 17:27:14930검색
코드 복사 코드는 다음과 같습니다.

//loading
function showLoad(tipInfo) {
var iWidth = 120; //팝업 창 너비;
var iHeight = 0; //팝업 창 높이;
var scrolltop = 0;
var scrollleft = 0;
var cheight = 0 ;
var cwidth = 0;
var eTip = document.createElement('div');
eTip.setAttribute('id', 'tipDiv') ;
eTip.style.position = '절대';
eTip.style.display = '없음';
eTip.style.border = 'solid 0px #D1D1D1';
eTip.style. backgroundColor = '#4B981D';
eTip .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. documentElement.scrollLeft;
scrolltop=document .documentElement.scrollTop;
cheight=document.documentElement.clientHeight;
cwidth=document.documentElement.clientWidth;
}
iHeight = eTip.offsetHeight;
var v_left=(cwidth-iWidth )/2 scrollleft; //
var v_top=(cheight-iHeight)/2 scrolltop;
eTip.style.left = v_left 'px';
eTip .style.top = v_top 'px';
eTip.innerHTML = ' '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.왼쪽 = 0 "px";
xp_mark.style.top = 0 "px";
xp_mark.style.position = "절대";
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 = "블록 ";
}
else {
//div explainDiv를 페이지에 추가합니다. 본문 바로 다음의 첫 번째 요소여야 합니다. 그렇지 않으면 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() }
}
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.