Created
May 30, 2017 08:28
-
-
Save Kassares/4c182b9d3ffdf851cf300e9dcd9384e0 to your computer and use it in GitHub Desktop.
toTop button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$(window).scroll(function() { | |
if($(this).scrollTop() != 0) { | |
$('#toTop').fadeIn(); | |
} else { | |
$('#toTop').fadeOut(); | |
} | |
}); | |
$('#toTop').click(function() { | |
$('body,html').animate({scrollTop:0},800); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment