-
-
Save codingwithsara/3e29045f27a271996bc9d656c03f0e0c to your computer and use it in GitHub Desktop.
jQuery ScrollTop-5
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
<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