Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 1x | /** * 获取 DOM 元素相对于 document 的边距 * @method dom/offset * @see https://github.com/timoxley/offset * @param {Object} node 要计算 offset 的 dom 对象 * @return {Object} offset 对象 * @example * var $offset = require('@spore-ui/kit/packages/dom/offset'); * var target = document.getElementById('target'); * console.log($offset(target)); * // {top: 69, left: 108} */ var offset = function () { return {}; }; Eif (typeof window !== 'undefined') { // eslint-disable-next-line global-require offset = require('document-offset'); } module.exports = offset; |