react-dyn-tabs
Version:
React dynamic tabs with full API
12 lines • 390 B
JavaScript
/**
*
* @param {Object} btnEl
* @param {Number} margin
*/
export default function (btnEl, margin) {
var _btnEl$getBoundingCli = btnEl.getBoundingClientRect(),
top = _btnEl$getBoundingCli.top,
bottom = _btnEl$getBoundingCli.bottom;
bottom = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0) - bottom;
return Math.max(top, bottom) - margin;
}