首页 > 其他 > 详细

元素页面定位居中函数

时间:2015-10-31 18:33:34      阅读:321      评论:0      收藏:0      [点我收藏+]
function centerposition( obj ){
     var wWidth = document.documentElement.clientwidth;
     var wHeight = document.documentElement.clientHeight;
     var oWidth = obj.offsetWidth;
     var oHeight = obj.offsetHeight;
     obj.style.left = (wWidth - oWidth) / 2 + ‘px‘;
     obj.style.top = (wHeight - oHeight) / 2 + ‘px‘;
}

  

元素页面定位居中函数

原文:http://www.cnblogs.com/fuxiang-yang/p/4925799.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!