height
Version:
Get the height the element should be
34 lines (23 loc) • 602 B
Markdown
[](http://travis-ci.org/chemzqm/height)
Get the height the element should be when use `height: auto`
Sometimes min-height has bugs or can not be used
npm i height
``` js
var height = require('height')
// only used for box-sizing: border-box
function setHeight(el) {
if (el.style.height == 'auto') return
var h = height(el)
if (h < 200) {
el.style.height = h + 'px'
} else {
el.style.height = 'auto'
}
}
```
Return the height value the element should be