Created
April 19, 2017 15:52
-
-
Save ColtMoney/006fbe4a7d64fcdbd57fae07954be076 to your computer and use it in GitHub Desktop.
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
$(".scroll-top-box").hide(); | |
$(window).scroll(function (){ | |
if ($(this).scrollTop() > 500){ | |
$(".scroll-top-box").fadeIn(); | |
} else{ | |
$(".scroll-top-box").fadeOut(); | |
} | |
}); | |
$(".scroll-top-box").on("click", function(){ | |
$('html, body').animate({scrollTop:0}, 'slow'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment