Answer the question
In order to leave comments, you need to log in
How to smoothly hide menu using css and jquery?
Hello, it is necessary that on the first screen the menu should be in the usual position, then when scrolling down the page, it smoothly leaves from above, and when scrolling up, it also smoothly hides back. I am using code:
$(window).scroll(function(){
if ($(this).scrollTop() > 350) {
$('.header').addClass('fixed');
} else {
$('.header').removeClass('fixed');
}
});
.header {
height: 50px;
top: -50px;
transition: top 1s; }
.fixed {
z-index: 99999;
position: fixed;
top: 0;
width: 100%;
transition: top 1s; }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question