- This topic has 13 replies, 4 voices, and was last updated 5 months, 2 weeks ago by
David.
-
AuthorPosts
-
September 27, 2022 at 3:57 am #2355073
Jin
Hi there
I have a widget on the right of the page that I want to float as the user scrolls up / down.
How can I implement this?
September 27, 2022 at 6:09 pm #2355829Fernando Customer Support
Hi Jin,
Are you referring to the entire right side bar? If so, it wouldn’t fit.
Usually, it’s just one widget in the sidebar that’s made sticky if the sidebar is content is long.
Let us know.
September 30, 2022 at 4:09 am #2358641Jin
Hi Fernando
Yes, just one widget. Is that possible to implement?
September 30, 2022 at 4:17 am #2358647Jin
Actually, when you refer to a “widget”, are you referring to a “container” in GeneratePress? I’m thinking of a few elements (which can be wrapped into a single container).
Please refer to this.
September 30, 2022 at 11:06 am #2359168Ying
StaffCustomer SupportYou are using WP columns which will be difficult to make it sticky.
Can you use the Grid block of GenerateBlocks instead?
October 2, 2022 at 3:54 am #2360335Jin
I am using GenerateBlocks. You can view my layout here.
October 2, 2022 at 4:42 am #2360347Jin
Ying
I’ve made a video explaining what I’d like to do because I don’t think I explain in well in writing. Please listen so my voiceover and screencast here.
October 2, 2022 at 11:40 am #2360784Ying
StaffCustomer SupportHi Jin,
Thanks for the video, I understand what you are looking for, but as I replied in my last comment, you are using WP columns block which is very difficult to make work as it doesn’t have an inner container inside the sidebar.
Can you try using the Grid block of GB instead to make the sidebar?
https://www.screencast.com/t/xiRHuJg3October 3, 2022 at 8:53 am #2361731Jin
Ying
I don’t understand what you mean. I think that I am using GenerateBlocks. I have the plugin installed and think that I’m using it.
I don’t understand what you mean by “doesn’t have an inner container inside the sidebar”.
I don’t know how I can make what I have now to “the Grid block of GB”. I looked at your screencast link and don’t understand what that means.
October 3, 2022 at 1:44 pm #2361980Ying
StaffCustomer SupportI took a screenshot in a page editor, as you can see these are 2 different blocks, Grid block is from GB, columns block is from WP:
https://www.screencast.com/t/vrEmJGvrHThe HTML structure of the Columns block doesn’t have an inner container that we can target to make it sticky, so please use the Grid block from GB.
I hope I’ve made it clear.
October 4, 2022 at 2:03 am #2362404Jin
Ying
Okay I finally understand what you mean. Didn’t realise the difference between grid and columns.
The area where the sidebar is has now been updated to a grid block.
Please give me directions on how to make it sticky or let me know if I missed something.
Thanks
October 4, 2022 at 9:59 am #2363049Ying
StaffCustomer SupportAwesome, now you can add this CSS:
@media (min-width: 768px) { { .gb-container.gb-container-43b143dc > .gb-inside-container { position: sticky; top: 100px; } }
Adding CSS: https://docs.generatepress.com/article/adding-css/
October 7, 2022 at 4:11 am #2366071Jin
I’ve added the CSS to the page and cleared the cache but nothing is happening. Am I supposed to give the container that I want to float a CSS class name?
October 7, 2022 at 5:21 am #2366139David
StaffCustomer SupportHi there,
it will require a little more work than that.
1. Can you edit the page, select the Column you have for your sidebar.
In Advanced > Additional CSS Class(es) add:custom-sidebar
2. Select the Container Block that has the items you want to Float. And give that an Advanced > Additional CSS Class of
is-sticky
3. Publish those changes.
4. Remove any of the previous CSS and add tbis instead:
@media(min-width: 769px) { .custom-sidebar > .gb-inside-container, .custom-sidebar > .gb-inside-container > .gb-container, .custom-sidebar > .gb-inside-container > .gb-container > .gb-inside-container { height: 100%; } .is-sticky { position: sticky; top: 100px; } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.