Skip to content

Instantly share code, notes, and snippets.

@dejoe
Created March 3, 2011 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dejoe/853841 to your computer and use it in GitHub Desktop.
Save dejoe/853841 to your computer and use it in GitHub Desktop.
Jquery Scroll To View Port
jQuery.fn.scrollToViewPort = function(animTimeInterval) {
animTimeInterval = (typeof animTimeInterval == "undefined")?"slow":animTimeInterval;
return this.each(function(){
$('html,body').animate({scrollTop: $(this).offset().top},animTimeInterval);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment