XF 2.1 Sticky header

Finexes

Well-known member
Hey guys,

I created a custom skin and have a few issues with the sticky header.

1) When I open a post directly via its URL (e.g. https://finexes.com/threads/opera-gx-webbrowser-fuer-gamer.14662/#post-45619), the page jumps down to the post. Unfortunately, my header has a height of 120px (XenForo's default header has only a height of about 37px), therefore jumps too far and overlaps part of the post. I would need to adjust the offset to the top of the page, how can I do that?

2) There is also a problem with content that is loaded after the page is rendered. Assume I am viewing my profile page and switching to the tab "Latest activity", new content is loaded and that extends the page's initial height. When I scroll down now, my header jumps to the bottom of the page. This does not happen with XenForo's default style. Can anyone point me in the right direction, how to fix this?

Thanks for your help!
 
Soooooo, after a few months, I was finally able to fix this, thanks to @DeltaHF in this post:

To expand on this, and for future reference to anyone else who encounters it, this offset can easily be changed.

In app.less, simply add pixels to the height and margin-top properties. In this example below, I am moving the target offset "up" the page by an additional 30 pixels:

Less:
.u-anchorTarget
{
    .m-stickyHeaderConfig(@xf-publicNavSticky);
    height: (@_stickyHeader-height + @_stickyHeader-offset + 30);
    margin-top: -(@_stickyHeader-height + @_stickyHeader-offset + 30);
}

I needed to do this because I made moved the p-sectionlinks to be inside the sticky header container. The height of this additional element is obviously not included in the calculation in the default templates so I just had to make this quick change.

 
Back
Top Bottom