Skip to content

Instantly share code, notes, and snippets.

@outman
Created November 26, 2012 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outman/4146107 to your computer and use it in GitHub Desktop.
Save outman/4146107 to your computer and use it in GitHub Desktop.
back to top
$(document).ready(function(){
$("#back-top").hide();
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#back-top').fadeIn();
} else {
$('#back-top').fadeOut();
}
});
$('#back-top a').click(function () {
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment