Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
up-button
$(document).ready(function(){
var offset = 220;
var duration = 700;
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('.topo').fadeIn(duration);
} else {
$('.topo').fadeOut(duration);
}
});
$('.topo').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
})
});
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.