The script doesn't work responsible for the appearance of the element when best personal Finance?

0 like 0 dislike
5 views
Here is the website xxx.devshift.co.uk.
here is a script which I use
$(window).scroll(function(){if($(window).scrollTop()>595){$('#menu-fixed').css('display','block');}else{$('#menu-fixed').css('display','none');}});

The script is pretty simple, but the element that should hide still displayed or hidden after a small scroll and after 595px appears again. Here is the photo of the item which needs to be hidden. If you scroll a bit down and up at once he will disappear and appear according to the script. But I can not understand why it is displayed immediately. after all, he should not. Prescribed script where possible did not help
5ae5b0939b1dc511862366.png Is it possible that this is due to the fact that the item was originally written display: flex; ???
by | 5 views

1 Answer

0 like 0 dislike
What do you mean "immediately"? To scrolling? Well, he is set to change only after scrolling.
$( document ).ready(function() { $('#menu-fixed').hide(); $(window).scroll(function(){ if($(window).scrollTop()>595){ $('#menu-fixed').show(); }else{ $('#menu-fixed').hide(); } }); });

or don't touch the js and put it in default in .css
#menu-fixed { display: none; }
by
110,608 questions
257,186 answers
0 comments
33,943 users