Skip to content

Instantly share code, notes, and snippets.

@diegogangl
Created April 26, 2012 17:56
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 diegogangl/2501442 to your computer and use it in GitHub Desktop.
Save diegogangl/2501442 to your computer and use it in GitHub Desktop.
Simple function to smooth-scroll to the bottom of the page with a basic ease
// -------------------------------------------------------------------------------
// Metodo scrollear al final de la pagina
scrollToBottom : function()
{
var acceleration = 1;
var totalOffset = 0;
var step = 1;
var scrollTimer = setInterval( function()
{
window.scrollBy(0, (step + acceleration));
offset = Math.max( window.pageYOffset, document.documentElement.scrollTop );
acceleration++;
if( totalOffset >= offset )
{
clearInterval( scrollTimer );
}
else
{
totalOffset = offset;
}
}, 5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment