Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Making specific container sticky

  • 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,

    tried but didn’t work

    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/MAdLSsFdNxOD

    Once it’s done we can take another look.

  • Oh I see, ok done that.

  • To clarify, do you want the entire Dictionary section sticky or just the alphabet buttons?

  • Just the alphabet to be sticky.

  • 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.

  • The sticky effect works well.
    However I notice that on mobile, on my landing page one of the buttons (‘BOOKS’) has now become sticky.

  • Can you reshare the exact page in question?

  • Ofc, I have provided it again below

  • Would you want it sticky just on Desktop? I’m not seeing a “Books” button on mobile as well.

  • 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.

  • 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;
    }
  • EDIT: sorted! Now ti appears to work fine. Thank you:)

  • You’re welcome!

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.