Adding offset to scroll for fixed mobile header
-
Hi,
I am using responsive.menu and loving it! Great job with the plugin.
Only problem I encounter is that the fixed header partially or fully covers my post and section titles. Is there a way to add an offset = height of header bar. And can I add that directly to the custom css section, or do I need some Jquery code?
Thanks
-
Hey there,
There is no way to do it with the plugin but you can just add a top margin or padding to the body element that matches the height of the header bar (thats what I do on my site).
Peter
Hey Peter,
I’m aware that the padding/margin-top code will work, but that pushes my content down, which is not my desired outcome.
I guess I will have to find some jquery method.
Thanks anyways
Hi there,
Im confused. If you push the body down that will push titles and content which is what you need.
You definetely dont need jquery for this.
What happened when you tried it so I can see?
Peter
I see your point, and I thought the same… But that only pushes the body under the header when at the top of the page. When I press an anchor link, or a menu item with a link to a section of the page, it still doesn’t push the content UNDER the header.
Weird…
I tried adding
body {
padding-top: 80px;
}I’ve also tried using “margin”… but css doesn’t quite do it…
No luck…Here’s a clip I recorded that makes it easier to see what is going on:
https://youtu.be/uyCVa2L3h_gHey there,
What about 100px or 120px, that doesn’t work either?
I can’t think of any reason why it wouldn’t…
Peter
I tried 120px just to see what would happen… And, it only made a white space between the header and the body appear. Whenever I click a link that scrolls down the page -> same thing happens…
#frustrated
Hi there,
Right ok I see the problem now and yes this won’t work.
I just did a quick 2 min Google search and found the suggestions below which you can try below:
http://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header
Hope it helps
Peter
The topic ‘Adding offset to scroll for fixed mobile header’ is closed to new replies.