Created
May 7, 2013 20:24
-
-
Save jlittlejohn/5535817 to your computer and use it in GitHub Desktop.
JS: Back to Top
This file contains hidden or 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
# back to top | |
$ -> | |
$(window).scroll -> | |
if $(this).scrollTop() > 100 | |
$("#back-to-top").fadeIn() | |
else | |
$("#back-to-top").fadeOut() | |
# scroll body to 0px on click | |
$("#back-to-top").click -> | |
$("body,html").animate | |
scrollTop: 0 | |
, 800 | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment