Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: NaneK on February 13, 2017, 08:25:42 PM

Title: Offsetting Anchor Links with Fixed Header
Post by: NaneK on February 13, 2017, 08:25:42 PM
Hello,

I am working on my theme and I hit a dead end...

My theme is using position:fixed global menu that is on top of the site.
The problem is when I visit anchor link (eg. last post button) and I get to that post, my global menu covers some of user info on user profile. I would like to add offset (margin-top or padding-top) to those links, so when I visit anchor link global menu displays a few pixels above user profile.

You can see it here on images

Title: Re: Offsetting Anchor Links with Fixed Header
Post by: Gluz on February 14, 2017, 04:41:00 PM
I have this problem in one edit of one theme.

Search in /Themes/your_theme/Display.template.php for this:
// Show the message anchor and a "new" anchor if this message is new

In the part
<a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';

Modify like this:
<a id="msg', $message['id'], '" style="display:block;"></a>', $message['first_new'] ? '<a id="new" style="display:block;"></a>' : '';

That way, the anchor link will be just in the right place.
Title: Re: Offsetting Anchor Links with Fixed Header
Post by: NaneK on February 14, 2017, 04:54:36 PM
Man this works like magic, thank you soooooooooo much  ;D ;D ;D ;D ;D