团委工作

首页 >> 党群纪检 >> 团委工作
更多...青年工作
更多...基层团讯
友情链接:小偷程序  镜像站群

免责声明: 本站资料及图片来源互联网文章,本网不承担任何由内容信息所引起的争议和法律责任。所有作品版权归原创作者所有,与本站立场无关,如用户分享不慎侵犯了您的权益,请联系我们告知,我们将做删除处理!

$(document).ready(function(){ }); //center pop///// //这个函数主要的功能计算页面的大小,屏幕的大小,返回值为Array,不必要细读,返回值为一个Array function ___getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); return arrayPageSize; }; function showProc(){ var message_box = document.getElementById("message_box"); var cPop = document.getElementById("cPop"); message_box.style.visibility='visible'; cPop.style.display='block'; // message_box.style.left = var pageSize = ___getPageSize();//这里的方法 返回的是页面的宽度,页面的高度,屏幕的高度,屏幕的宽度! var pageWidth = pageSize[0];//页面的宽度 var pageHeight = 506;//页面的高度 var ScreenWidth = pageSize[2];//屏幕的宽度 var ScreenHeight = pageSize[3];//屏幕的高度 var divWidth = 500;//div的宽度 var divHeight = 352;//div 的高度 message_box.style.width = divWidth+"px";//设置div 的宽度 message_box.style.height = divHeight+"px";//设置div的高度 message_box.style.left = (ScreenWidth-divWidth)/2+"px";//弹出div层屏幕中水平居中的位置 message_box.style.top = (ScreenHeight-divHeight)/2+"px";//弹出div层屏幕垂直居中的位置 //message_box.style.top = (ScreenHeight-pageHeight+divHeight)/2+"px";//弹出div层,所属上一层div居中的位置,本实例中就为contentDiv高度一半的位置 //alert(pageSize) 打印的数据可以看出ScreenHeight 和PageHeight的高度是一样的,可能__getPageSize计算屏幕或者页面的高度有问题!所以关于div垂直居中的问题,请大家手动解决 //创建灰色背景层 procbg = document.createElement("div"); procbg.setAttribute("id","mybg"); procbg.style.background = "#fff"; procbg.style.width = "100%"; procbg.style.height = "110%"; procbg.style.position = "absolute"; procbg.style.top = "0"; procbg.style.left = "0"; procbg.style.zIndex = "500"; procbg.style.opacity = "0.5"; procbg.style.filter = "Alpha(opacity=50)"; //背景层加入页面 document.body.appendChild(procbg); document.body.style.overflow = "hidden"; } //拖动 $().ready(function() { $('#message_box').Drags({ handler: '#dragDiv', zIndex:200, opacity:.9 }); }); function closeProc(){ var message_box = document.getElementById("message_box"); message_box.style.visibility='hidden'; procbg.style.visibility = "hidden"; cPop.style.display='none'; document.body.style.overflow = "auto"; }