I'm using Foundation 5 and the sticky header.
Here is my code:
<header>
<div class="sticky">
<nav class="top-bar" data-topbar role="navigation">
<!-- Blablabla -->
</nav>
</div>
</header>
The problem with this version is that when I scroll down for the first time, the sticky header doesn't work. I have to scroll down, then up to the top of the page and after the sticky header works.
After that, I've add the class fixed <div class="sticky fixed"> but once the page is loaded, this hide my element on the top of the page instead of going above them.
So my workaround is to add, then remove the class fixed after the page has been loaded. With that change, the header gets sticky during the first scroll, but it looks like to not be the perfect solution, and it has side effects :/
$('header .sticky').addClass("fixed");
$('header .sticky').removeClass("fixed");
Another solution is to fixe the header and apply a margin-top to all elements. But we loose the benefits of the sticky class.
Any idea for a better solution / find the source of the issue?