I'm trying to have my page not show a header until the user scrolls 600px. I've come up with the code below by parsing through the jquery docs, but I can't seem to make it work. A little help in the right direction would be much appreciated. Thanks!
UPDATE: I've figured it out. I had the selector period before the class name. I'm not seeing the duration transition fire though. $("header").removeClass("header-hidden", 1000); Any advice there?
HTML
<header class="header-fixed header-hidden shadow">
<section>
<nav>
<ul>
<li>one</li>
<li>two</li>
</ul>
</nav>
</section>
</header>
CSS
.header-fixed { position: fixed; top: 0; left: 0; width: 100%; }
.header-hidden { display: none; }
header { z-index: 999; margin: 0; overflow: hidden; height: 70px; background: rgba(255, 255, 255, 0.9); position: relative; }
Jquery
<script>
$(window).scroll(function () {
if ($(this).scrollTop() < 600) {
$("header").removeClass("header-hidden", 1000);
}
else
$("header").addClass("header-hidden", 1000);
});
</script>