元素页面定位居中函数
时间:2015-10-31 18:33:34
收藏:0
阅读:322
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)