Skip to content

Instantly share code, notes, and snippets.

@iredun
Created April 20, 2017 11:52
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 iredun/ba8465c5c6474baf214dfe7368b20742 to your computer and use it in GitHub Desktop.
Save iredun/ba8465c5c6474baf214dfe7368b20742 to your computer and use it in GitHub Desktop.
scrollTo jQuery extend
jQuery.fn.extend(
{
scrollTo : function(speed, easing)
{
return this.each(function()
{
var targetOffset = $(this).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment