showing results for - "back to top scroll animation jquery"
Céline
30 Sep 2019
1$(function() {
2    $(window).scroll(function() {
3        if($(this).scrollTop() != 0) {
4            $('#toTop').fadeIn();    
5        } else {
6            $('#toTop').fadeOut();
7        }
8    });
9
10    $('#toTop').click(function() {
11        $('body,html').animate({scrollTop:0},800);
12    });    
13});​
14