当前位置: 代码迷 >> Web前端 >> jquery 弹出层正中设置
  详细解决方案

jquery 弹出层正中设置

热度:67   发布时间:2012-07-25 09:43:05.0
jquery 弹出层居中设置
var iWidth = document.documentElement.clientWidth;
var iHeight = document.documentElement.clientHeight;
var scrollHeight = document.documentElement.scrollTop;//文档卷去高度

var oShow = document.getElementById('show');

oShow.style.left = (iWidth-oShow.offsetWidth)/2+"px";
oShow.style.top = (iHeight-oShow.offsetHeight)/2+scrollHeight+"px";
  相关解决方案