Perhaps you could consider incorporating my latest update:
https://jsfiddle.net/k3AHM/37/
Here are the key changes I made:
1. Implemented a check to see if the animation function has already been executed to prevent repetitive calls on scroll.
2. Opted for slideDown() over the "animate" function for added interest, although you can still use "animate" if preferred.
Below is my revised code:
var AlreadyRun=0;
$(document).ready(function(){
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 110) {
//$('.menu-container').addClass( "fix-menu" ).animate('top', '-3px');
if(AlreadyRun == 0){
AlreadyRun=1;
//alert('function starts, AlreadyRun='+AlreadyRun);
$('.menu-container').hide().addClass( "fix-menu" ).slideDown('slow');
}
} else {
AlreadyRun=0;
$('.menu-container').removeClass("fix-menu");
}
});
});
In addition, I believe eliminating the "transition" property in CSS is unnecessary, so I have updated the CSS as follows:
.menu-container {
/* transition: all .3s ease-in-out; */
background:red;
margin-top:0;
}
.fix-menu{
/* transition: all .3s ease-in-out;*/
box-shadow: 0 5px 10px 0.5px rgba(0, 0, 0, 0.1);
height: 54px;
left: 0;
top:0;
overflow: hidden;
position: fixed;
right: 0;
z-index: 1500;
/* transition: all 0.2s ease-in; */
}
I trust this aligns with your requirements.