Skip to content

Instantly share code, notes, and snippets.

@nagataka
Created September 16, 2013 03:48
Show Gist options
  • Save nagataka/6576539 to your computer and use it in GitHub Desktop.
Save nagataka/6576539 to your computer and use it in GitHub Desktop.
template of making "page top" link using jquery
//script
$(function() {
topBtn.click(function () {
$('body,html').animate({
scrollTop: 0
}, 1000);
return false;
});
});
//css
#pageTop{
background:#DDD;
color:#FFF;
border-radius:8px;
padding:10px;
position:fixed;
bottom:20px;
right:20px;
}
//html
<a id="pageTop" href="#topContent">Page top</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment