Created
April 20, 2017 11:52
-
-
Save iredun/ba8465c5c6474baf214dfe7368b20742 to your computer and use it in GitHub Desktop.
scrollTo jQuery extend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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