Scroll to top javascript
/**
* The "Back-to-Top" Button.
*/
$('.back-to-top').click(function(e){
$('body, html').animate( { scrollTop: 0 } , 1000 , 'easeInOutCirc' );
e.preventDefault();
});
$('.back-to-top').hide();
$(window).scroll(function(){
var window_width = $(window).width();
if( $(this).scrollTop() > 250 && window_width > 1024 ){
$(".back-to-top").fadeIn();
} else {
$(".back-to-top").fadeOut();
}
});
<a href="#" class="back-to-top"><i class="fa fa-angle-up"></i></a>