MyBB Community Forums

Full Version: Problem using fixed header – need to offset viewport
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
OK, so here's the deal. Since I'm using a fixed header, when you click, say, "last post", or anything referencing #pid you get this, covering the username and date.

[Image: 308gi.png]

The result should be, ideally, like this:

[Image: vCpLt.png]

Now, this is an easy fix if you know the ID/name of the anchor you are trying to link to by using a pseudo-element.

#target:before {
   content:"";
   display:block;
   height:50px;
   margin:-30px 0 0;
}

source: http://nicolasgallagher.com/jump-links-a...sitioning/

The problem is that since the anchor for each PID is unique, there's no way to target them all this way. Does anyone have any solution for how I could do this?
I haven't tried it, but this might work:
#posts a[href*='pid']:before

That would take an anchor who's href contains "pid".
Why not just add the same title to all the anchors through the templates, then do:

a[title="anchor-location"]:before {
content:"";
display:block;
height:50px;
margin:-30px 0 0;
}

Haven't tried it so don't know if it'll work.

Edit: beat by Ryan xD
Neither works Sad
Have you tried just adding a class with the offset CSS to the anchor tag?

edit: it seems to work if you just stick that css in a class
edit2: never mind, that's not right
Brad - I have exactly the same issue and it is driving me mad.

I am even ready to go for a js solution, but not jQuery Sad
style="padding-top: 30px"

to <a> tag?

??
well, I applied a class "tag" to the postbit_posturl (that is where the hashtag is), and even though it all seems to be correct the header keeps overlapping.

I have tried the body padding as on bootstrap - still keeps doing it. I have tried the various fixes for the "bug" - none work.
Did you add it to the <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a> tag?
(2013-01-19, 01:05 AM)Scoutie44 Wrote: [ -> ]style="padding-top: 30px"

to <a> tag?

??

Doesn't work.
Pages: 1 2 3 4 5