Why doesn't the script menu when best personal Finance?

$(document).scroll(function () {
 var y = $(this).scrollTop();
 var screen_height = window.innerHeight;
 var scroll_height = document.body.scrollHeight;
 var when_show_menu = scroll_height - screen_height;
 if (y > when_show_menu ) {
$('#navigator').fadeOut();
 } else {
$('#navigator').fadeIn();
}

 });


And this works:
$(document).scroll(function () {
 var y = $(this).scrollTop();
 if (y > 2000) {
$('#navigator').fadeOut();
 } else {
$('#navigator').fadeIn();
}
 });
July 8th 19 at 11:29
1 answer
July 8th 19 at 11:31
var screen_height = window.innerHeight;
var scroll_height = document.body.scrollHeight;
O_o
Where do you take all this nonsense... just use jQuery, so use it.

var screen_height = $(window).height();
var scroll_height = $(document).height();

And by the way, Your code works exactly as it should!
strange, I do not work your as well. - jaycee commented on July 8th 19 at 11:34
only such works
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 2000) {
$('#navigator').fadeOut();
} else {
$('#navigator').fadeIn();
}
}); - jaycee commented on July 8th 19 at 11:37
: You seem to not understand!
I repeat: Your code works as it should (both the first and the second). - Gisselle.Sporer commented on July 8th 19 at 11:40

Find more questions by tags CSSjQueryJavaScriptHTML