I am making a website, where I want the navbar to change its position to 'fixed' when I scroll past it.
There is a problem though. The design completely messes up when I change its position value. See www.rowweb.dk/skyline/ - I'm using Bootstrap by the way.
I have the following block of code so far:
$(window).scroll(function () {
winHeight = $(window).height();
if ($(window).scrollTop() > winHeight) {
$('.navbar').css('position', 'fixed');
$('.navbar').css('top', '0');
}
});
Does anyone have a solution to my problem?