Answer the question
In order to leave comments, you need to log in
How to create a horizontal menu that appears after scrolling?
Interested in not a simple moment, in fact the menu should appear after scrolling a certain number of pixels. But there is one thing, it should be formed only after scrolling, and should not be shown on the site before. When scrolling up, it should be deleted completely, because there is already a menu at the top. Unfortunately, I can not show an example, because I simply did not find it.
The script I use is this:
$(function () {
$(window).scroll(function(event) {
if($(this).scrollTop() > 150) {
$("#menu").fadeIn();
$("#menu").addClass('fixed')
}
else {
$("#menu").removeClass('fixed')
}
});
});
Answer the question
In order to leave comments, you need to log in
Why do you need a new menu? When scrolling, add a new class to your menu, exclude it from the flow using fixed, and so that the content does not leave the menu height up, use margin-top.
And in the new class, redefine your menu as you want, at least the appearance, at least hide some items.
Here is an example I wrote for a similar question.
codepen.io/iiil/pen/InDbp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question