I'm using a simple jquery "scroll to top" plugin I found online and it's working well. However, I want to fade out my 'scroll to top' button when I'm 100px off the bottom of the page. Can anyone help? Here's a fiddle - https://jsfiddle.net/p1em9gph/
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
<a href="#" class="scrollToTop">Scroll To Top</a>