-
abmmgb
Hi, I want to make the container within which the alphabet section is located (webpage provided in private) sticky at the top of the page on scrolling down.
I have tried the following,
I would be grateful for any advice.
-
Hi there,
It’s not possible based on your current HTML structure.
You need to change your structure to this, drag the wp-block-group into the parent container of the page, so it becomes a sibling to the alphabet container.
https://www.screencast.com/t/MAdLSsFdNxODOnce it’s done we can take another look.
-
abmmgb
Oh I see, ok done that.
-
Fernando
To clarify, do you want the entire Dictionary section sticky or just the alphabet buttons?
-
abmmgb
Just the alphabet to be sticky.
-
Fernando
Try adding this through Appearance > Customize > Additional CSS:
.gb-container.gb-container-62a240a0 { position: sticky; top:60px; } .gb-container.gb-container-b429ea89 { position:relative; } .gb-container.gb-container-a3d597d7 { overflow-x:unset; overflow-y:unset; }
Add a Background color to the Container Block holding the Alphabet so it appears better.
-
abmmgb
The sticky effect works well.
However I notice that on mobile, on my landing page one of the buttons (‘BOOKS’) has now become sticky. -
Fernando
Can you reshare the exact page in question?
-
abmmgb
Ofc, I have provided it again below
-
Fernando
Would you want it sticky just on Desktop? I’m not seeing a “Books” button on mobile as well.
-
abmmgb
So, the books button is on the homepage – this has now become sticky.
Re the alphabet on the /lexicon webpage, I want to habe it sticky on all devices.
-
Fernando
I see.
Give the Container Block a
make-sticky
class. Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/Then replace the CSS we had with this:
.gb-container.make-sticky { position: sticky; top:60px; } .gb-container.gb-container-b429ea89 { position:relative; } .gb-container.gb-container-a3d597d7 { overflow-x:unset; overflow-y:unset; }
-
abmmgb
EDIT: sorted! Now ti appears to work fine. Thank you:)
-
Fernando
You’re welcome!
- You must be logged in to reply to this topic.