File size: 466 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
export function calculateMetricsSectionScrollOffset() {
let offset = 0;
const headerEl = document.getElementById( 'header' );
const menuHeight = 92;
// Offset to account for Masterbar if it is fixed position
offset +=
headerEl && getComputedStyle( headerEl ).position === 'fixed'
? headerEl.getBoundingClientRect().height
: 0;
// Offset to account for the metrics menu navbar
offset += menuHeight;
const padding = 30;
return offset + padding;
}
|