get-height.js 338 B

12345678910111213
  1. /**
  2. * 获取高度
  3. * @param {HTMLElement} el dom节点
  4. * @param {Number} defaultValue 默认值
  5. * @return {Number} 高度
  6. */
  7. module.exports = function getHeight(el, defaultValue) {
  8. var height = this.getStyle(el, 'height', defaultValue);
  9. if (height === 'auto') {
  10. height = el.offsetHeight;
  11. }
  12. return parseFloat(height);
  13. };