Skip to content

Instantly share code, notes, and snippets.

@codingwithsara codingwithsara/index.html Secret
Created Jul 15, 2019

Embed
What would you like to do?
jQuery ScrollTop-5
<script>
$(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 300) {
$('#scroll').fadeIn();
} else {
$('#scroll').fadeOut();
}
});
$('#scroll').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.