Skip to content

Instantly share code, notes, and snippets.

@lucianobragaweb
Created November 12, 2013 15:06
Show Gist options
  • Save lucianobragaweb/7432371 to your computer and use it in GitHub Desktop.
Save lucianobragaweb/7432371 to your computer and use it in GitHub Desktop.
Botão Voltar ao topo com deslize suave
<div id="voltarTopo">
<a href="#" id="subir">Topo</a>
</div>
// JAVASCRIPT
$(document).ready(function() {
$('#subir').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
#subir{
position:fixed;
bottom:0px;
right:0px;
}
@CodakDev
Copy link

Como poderia centralizar esse objeto? Ao invés de esquerda ou direita, como posso deixar ele no meio?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment