Answer the question
In order to leave comments, you need to log in
How to make a fixed menu work not at a given size, but at 0?
There is a script:
$(function(){
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 160) $(".menu-fixed").css({top: '0', position: 'relative',});
else $(".menu-fixed").css({top: '0', position: 'fixed'});
});
});
Answer the question
In order to leave comments, you need to log in
if(top < $(".menu-fixed").offset()) {
//дальше все то же самое
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question