Skip to content

Instantly share code, notes, and snippets.

@mircobabini
Last active December 20, 2015 20:59
Show Gist options
  • Select an option

  • Save mircobabini/6194557 to your computer and use it in GitHub Desktop.

Select an option

Save mircobabini/6194557 to your computer and use it in GitHub Desktop.
jQuery AnimateTo Plugin - $.animateto (identifier, speed, easing, callback);
/*!
* jQuery AnimateTo Plugin
*
* Copyright 2012, Mirco Babini
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/
(function($) {
$.animateto = function (identifier, speed, easing, callback, offset) {
if (offset === undefined) offset = 0;
return $('html,body').animate ({ scrollTop: $(identifier).offset ().top }, speed, easing, callback);
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment