CSS element position 计算公式
以下部分element.style的属性值需要用到parseInt(value || 0)来转换。
- clientWidth = element.style.paddingLeft + element.style.width + element.style.paddingRight
- clientHeight = element.style.paddingTop + element.style.height + element.style.paddingBottom
- clinetLeft = borderLeftWidth
- clientTop = borderTopWidth
- clientRight = offsetWidth - clientWidth - clientLeft
- clientBottom = offsetHeight - clientHeight - clientTop
- element.style.left = element.offsetLeft - element.style.marginLeft
- element.style.top = element.offsetTop - element.style.marginTop
No comments :
Post a Comment