The code should work for both the old and new page generator. Vanilla JS
<!-- First, add the following JavaScript code in the Settings -> JavaScript -> Footer menu of your page: -->
<script>
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>
<!-- And now add the following CSS styles in the Settings - HTML/CSS menu: -->
<style>
.sticky-header{
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
</style>
<!-- First, add the following JavaScript code in the Settings -> JavaScript -> Footer menu of your page: -->
<script>
var header = document.querySelector('.section');
var headerHeight = header.clientHeight;
header.classList.add("sticky-header");
document.querySelector('body').style.marginTop = headerHeight + 'px';
</script>
<!-- And now add the following CSS styles in the Settings - HTML/CSS menu: -->
<style>
.sticky-header{
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
</style>