Site logo

[Support request] Sticky Sidebar Element (for ads)

Home Forums Support [Support request] Sticky Sidebar Element (for ads)

Home Forums Support Sticky Sidebar Element (for ads)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2398133
    James

    Hey there,

    My sidebar comprises two elements – the first element is a hook (generate_before_right_sidebar_content) and then there is a second element which is a Block (right-sidebar). I would like to make the second element (the right-sidebar) block sticky, but not the first. So you scroll past the first then the second stickys.

    I have been successful stickying the entire sidebar using the following:

    .inside-right-sidebar {
            position: sticky;
            top: 80px;
        }

    BUT this stickies the hook as well.

    I have also been successful just stickying a section if I use the sidebar widget, e.g.:

    aside#block-7{
        position: sticky;
        top: 80px;
    }

    BUT this means I can’t have multiple sidebar designs for different sections of my site.

    Is there an easy way to target the specific element? I have tried but no luck yet. Thanks in advance!

    #2398226
    David
    Staff
    Customer Support

    Hi there

    if you want to stick the last widget in the sidebar then you can do this:

    
    .inside-right-sidebar > :last-child {
        position: sticky;
        top: 80px;
    }
    #2398532
    James

    Thanks David, that worked!

    #2398668
    David
    Staff
    Customer Support

    Glad to hear that

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