[Support request] Sticking last widget in sidebar using elements?

Home Forums Support Sticking last widget in sidebar using elements?

  • This topic has 3 replies, 2 voices, and was last updated 2 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1367664
    gedosan

    Hi Guys

    I am using an element (a hook) to show something at the end of the right sidebar. Is there a way to make this stick to the end of the sidebar the same way Q2W3 Fixed Widget works? I don’t want to use that plugin as I have ads running on other pages that stick the ads to the sidebar, and I don’t want it interfering with that.

    By the way, if I can get this to work I’d want to add a load of these sidebar hooks, one per page. Hopefully there’s a way of doing it via a bit of PHP.

    Check out the page below. It’s not the final design yet (obviously) but want to know if its possible before I start improving it.

    Thanks
    G

    #1367667
    David
    Staff
    Customer Support

    Hi there,

    This is a CSS method for sticking widgets:

    @media (min-width: 769px) {
        .right-sidebar .site-content {
            display: flex;
        }
    
        .inside-right-sidebar {
            height: 100%;
        }
    
        #ID-of-sticky-widget {
            position: -webkit-sticky;
            position: sticky;
            top: 80px;
            z-index: 100;
        }
    }

    You can use the Browser inspector find the ID of the widget.
    For example the advert widget you have you swap this:

    #ID-of-sticky-widget

    for:

    #sidebar_btf_placeholder

    Which won’t work with that plugin running.
    But you could remove the plugin and stick the widget before the advert to have both of them stick.

    #1367817
    gedosan

    Amazing. I made it stick using the class rather than the ID. Assuming this is ok?

    #1368108
    David
    Staff
    Customer Support

    Yes, Classes are fine – just make sure they are unique or you may find they effect other widgets

    Glad to be of help

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