Oops, first I'll explain what I'll do.
I want to scroll and go through my menu, it stays on top . My website will have the menu in this style SITE EXAMPLE , an initial part that in my case occupies 100% of the screen (it is set to 100% height in css), and only then comes the menu.
So, for me to make it possible, I took the example of another question and put it in my code.
jQuery("document").ready(function($){
var nav = $('.nav-container');
$(window).scroll(function () {
if ($(this).scrollTop() > 750) {
nav.addClass("f-nav");
} else {
nav.removeClass("f-nav");
}
});
In css I put:
.f-nav{ z-index: 9999; position: fixed; left: 0; top: 0; width: 100%;}
And in html, I put the "nav-container" class in the session that encompasses all my menu, in case a < nav >.
However, the following errors occur:
As the height to set the menu is set to pixels in the case of 750 that appears in the JS code, and my home screen is set to% (100%) when I raise the screen or place to expand the browser, the position that the fixed menu changes place, does not stay exactly when it passes through it.
And another mistake is happening, when the menu is fixed, everything below it moves about 30 pixels up, it's as if the menu when it's fixed frees up space for the content to go up, and it's getting ugly. / p>
Does anyone know how I can fix these errors?