I have a sub-menu, that fadeIn at the top of a page if you scroll 150px. If you higher than the 150px it fadeOut.
That's works fine. Now I want that the sub-menu FadeOut at the end of the side, too. Like: FadeIn between 150px of the top and 150px before the page ends. Outside this area: FadeOut.
Here is my jQuery-Code:
function scrollSide($) {
if ($(window).width() >= 768) {
/*menu scroll*/
$(window).scroll(function () {
var scroll = $(window).scrollTop();
if (scroll >= 150) {
$("#navbar-example").fadeIn("easing");
$(".sidemenu").css("top", "92px");
} else {
$(".sidemenu").css("top", "170px");
$("#navbar-example").fadeOut("easing");
}
});
}
}
I need a if statement for the situation between the top of the page and the end of the page. Thanks a lot!