Archived topic
Element - Make image sticky
3 replies · Started by ammgbr on April 2, 2023
Hi, I have used an element to create a block content template that pulls dynamic data from ACF. I want to have the image sticky but the rest of the content to be scrollable.
You can see an example of a post in the private section.
Hi there,
1. Add a custom class sticky-image to the GB container that's holding the GB image blocks:
https://docs.generateblocks.com/article/advanced-options-overview/#additional-CSS-Class
2. Add this CSS and adjust the top value as you see fit:
.gb-container.sticky-image {
position: sticky;
top: 75px;
}
Learn how to add CSS: https://docs.generatepress.com/article/adding-css/
Thank you, had to change the custom class to `sticky-image' and it works beautifully ;p
Good catch!
Edited my answer above :)