// jQuery
$(document).ready(function() {
var stickyNavTop = $('.nav-band').offset().top;
var stickyNav = function(){
var scrollTop = $(window).scrollTop();
if (scrollTop > stickyNavTop) {
$('.nav-band').addClass('nav-sticky');
} else {
$('.nav-band').removeClass('nav-sticky');
}
};
stickyNav();
$(window).scroll(function() {
stickyNav();
});
});
// CSS
.nav-sticky {
border-top: 0;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 100;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.