Hi @bradhip
This feature is not available in the Greenlet theme. Thanks for this, we will add it to our roadmap.
Currently, you can implement this functionality by adding code like this to your child theme’s function.php:
function sticky_script() {
?>
<script type="text/javascript">
const topOffset = 100
const bottomOffset = 200
const sidebars = document.querySelectorAll( '.sidebar' )
const bodyHeight = document.body.offsetHeight
let stuck = false
function stick() {
sidebars.forEach( ( sidebar ) => {
if ( stuck && ( bodyHeight - sidebar.offsetHeight - bottomOffset ) < window.scrollY ) return
if ( window.scrollY > topOffset ) {
stuck = true
sidebar.style.position = 'relative'
sidebar.style.height = 'fit-content'
sidebar.style.top = <code>${ window.scrollY - topOffset }px</code>
}
} )
}
document.addEventListener( 'scroll', stick )
</script>
<?php
}
add_action( 'wp_footer', 'sticky_script' );
Please change topOffset
and bottomOffset
according to your needs. Please let us know if you face any issues.
Hope that helps!