lera.cernolev of Help Center Snippets
10/27/2019 - 5:42 PM

Migrated - HC || Sticky Header - Javascript

<!-- Begin "Sticky Header" || Help center -->
<!-- Insert in Settings->Javascript->Footer -->
<!-- CS:20201028-12-1 -->
<script data-cfasync="false">
document.addEventListener('DOMContentLoaded', stickyHeader);
window.addEventListener( 'resize', stickyHeader );

function stickyHeader() {
	var header = window.__page_generator ? document.querySelector('.section') : document.querySelector('.page-block');
	var headerHeight = header.clientHeight;
	header.classList.add("sticky-header");
	document.querySelector('body').style.marginTop = headerHeight + 'px';
}
</script>
<!-- End "Sticky Header" || Help center -->