Plugin Author
malihu
(@malihu)
Hello,
The plugin scrolls to the exact position of the target id. Is the position of the target element correct? Do you have a fixed menu overlapping content? If yes, then you probably need to an offset value in plugin settings.
I can’t provide actual help unless I see your page/code though…
Thread Starter
ksmen
(@ksmen)
Sorry, I was traveling and I unable to connect. I’m going up and you pongo the link.
Thanks and regards.
Thread Starter
ksmen
(@ksmen)
Hi again Malihu, this link is: http://hnospiernas.es/
Can u help me? :'(
Thanks!!
Plugin Author
malihu
(@malihu)
Sure.
The issue happens because of how your site’s layout works. Let me explain:
When you’re on the very top (haven’t scrolled down) the menu’s position is relative. When you scroll down a bit, the menu becomes fixed. The problem is that the relative menu occupies an area in the document (92 pixels) but when it becomes fixed, this area gets completely removed. This means that the overall body height changes the moment the menu becomes fixed.
The plugin script cannot re-calculate where to scroll while scrolling is underway! This is why when you click a link while the menu is relative, page scrolling is off by few pixels. The second time you click the link, page scrolling is “correct” as the link is in the fixed menu.
Hope all this makes sense 🙂
Now, the solution is to prevent the document from changing its total height when the menu changes its position property (relative/fixed). The easiest/most efficient way to do this is by adding the following to your theme’s CSS:
.navigation_menu.affix + * {
margin-top: 92px;
}
The above gives the element which sits next to the fixed menu a top margin of 92 pixels (the amount of area previously occupied by the relative menu).
This fixes the scrolling position issue and removes the unwanted layout “gap” when scrolling the page!
You can test it by slowly scrolling the page until menu becomes fixed. Without the CSS rule there’s a gap. Adding it, makes scrolling smooth (as it should be in the first place).
Thread Starter
ksmen
(@ksmen)
Hello Malihu,
I regret not having responded during these months, I have been traveling and just got back.
I have added the rule that you have told me in the CSS issue but still no go 🙁
Can you see it and see if there any solution?
Thanks and best regards!
Plugin Author
malihu
(@malihu)
I checked your link again and the rule is not set. I cannot find it when inspecting the page… Are you sure you placed it in your CSS? Maybe you have caching enabled?
The rule does work (I know because I’m testing it directly in browser’s dev tools on your site).
Let me know.
Thread Starter
ksmen
(@ksmen)
Now, thank you very much !.
It was because I was editing directly with filezilla and is not kept well !.
I have a small issue that happens with another web but the same subject … you could take a look and if you know how arregarlo tell me ?.
This website: http://byv.disebox.es/
I appreciate all the help a lot.
A hug.
Plugin Author
malihu
(@malihu)
Same principle:
.site-header + * {
margin-top: -50px;
}
.site-header.sticky + * {
margin-top: 116px;
}
@media screen and (min-width: 768px){
.site-header + * {
margin-top: 0;
}
.site-header.sticky + * {
margin-top: 131px;
}
}