getting header height

PHOTO EMBED

Wed Oct 18 2023 04:13:53 GMT+0000 (Coordinated Universal Time)

Saved by @kunal

var Header = document.querySelector('.atmc-header');
var body_wrp = document.querySelector('.body-wrapper');
if(Header){

  function getElHeight(){
    const elementHeight = Header.offsetHeight;
    var unit = "px"
    body_wrp.style.paddingTop = elementHeight + unit;
    console.log(elementHeight)
  }
  getElHeight();
  window.addEventListener("scroll", getElHeight);
  window.addEventListener("load", getElHeight);
  window.addEventListener("resize",getElHeight);
}
content_copyCOPY