I am trying to implement the scroll to top feature in my website: www.arrow-tvseries.com.
The \"button\" is seen on the website however it does not work properly, becaus
You could do something like this:
JSFiddle demo
$(window).scroll(function() {
// if you have scrolled down more than 200px
if($(this).scrollTop() > 200) {
$('#backtotop').fadeIn();
} else {
$('#backtotop').fadeOut();
}
});
$('#backtotop').bind('click', function(e) {
e.preventDefault();
$('body,html').animate({scrollTop:0},800);
});