How to fix menu?

0 like 0 dislike
11 views
How to fix the menu so that when you scroll it remains visible on top?
cosmofest.kvantorium48.ru
by | 11 views

1 Answer

0 like 0 dislike
var navPos = $('#main-navigation').offset().top; $(window).scroll(function(){ if ($(this).scrollTop()>=navPos) { $('#main-navigation').addClass('fixed'); } else { $('#main-navigation').removeClass('fixed'); } });

#main-navigation.fixed { position: fixed; top: 0; left: 0; right: 0; z-index: 10; margin-top: 0; }
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked May 21, 2019 by Agatnet
110,608 questions
257,186 answers
0 comments
33,901 users