Hi there, I'm in the process of creating a dynamic header/navigation bar similar to the one on this website:
Here's what I have so far:
Jquery:
$(document).ready(function() {
var lock = $('#header').position().top;
$(window).scroll(function() {
if(lock >= $(window).scrollTop()) {
if($('#header').hasClass('fixed')) {
$('#header').removeClass('fixed');
}
} else {
if(!$('#header').hasClass('fixed')) {
$('#header').addClass('fixed');
}
}
});
});
Html:
<div id="header" class=""></div>
Css:
#header {
width: 100%;
height: 80px;
background-color: #000;
left:0;
right: 0;
margin-top: 340px;
position: absolute;}
body {
height: 7000px;
width: 100%;
float: right;}
.fixed {
position: fixed;}
I would greatly appreciate any assistance. Thank you.