I have been trying to get my photos on this product page to stay sticky while scrolling until it reaches the next section. It seems that broadcast only does sticky form not the other way around and can’t seem to get the custom code edits to work. Anyone have any luck or know how to do this?
It sounds like you want to make the product images sticky while the user scrolls until they reach the next section. This should be achievable with some custom CSS and JavaScript.
Here’s a basic solution you can try:
CSS: Use position: sticky with a top value to make the images stick as you scroll. Here’s a sample:
.product-image {
position: -webkit-sticky;
position: sticky;
top: 20px; /* Adjust to where you want the image to start sticking */
}
JavaScript: If you need the images to stop being sticky once the next section reaches, you can use JavaScript to detect the scroll position and adjust the sticky behavior. Something like this:
const stickyElement = document.querySelector(‘.product-image’);
const nextSection = document.querySelector(‘.next-section’); // Replace with your next section class