Thread:Project:Support desk/link scroll position/reply (3)

You say that you have set the header and the left menu at a fixed position. Now when you click a link, e.g. in the table of contents, then this section heading is scrolled to the top of the viewport. The content then ends up at the same place, where your fixed header is so that the content is partly invisible.

Basically this could be solved with an iframe, which sits directly below your fixed menu and all the content is in that iframe. Iframes are old techniques and I don't know how to get MediaWiki to put your stuff inside an iframe.

I thought about whether it might be possible to give mw-body a margin-top of additional 152px, however, this would also move it down, when you are at the top of the page, which is not wanted.

I think maybe it is possible to do that by using a mixture of fixed and absolue positions, but I currently don't know how: I think it does not help to position the body with an absolute position: It then would start at the right place, but when you scroll, it would still go below the header. Also using a fixed position for the content does not help, as you basically want the content to scroll through the viewport.

So you want the element to be positioned relatively or absolutely, but its margin-top should be positioned fixed. This will not work; at leat not when you want both with the same element.

Maybe it is possible to fix that with jQuery? When someone clicks a link to an anchor inside the content (inside .mw-body?), then let jQuery scroll the viewport these 152 pixels up so that the heading appears in the visible area.