Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// jQuery('#myId').scrollToMe();
jQuery.fn.scrollToMe = function(speed,callFunc) {
var that = this;
setTimeout(function() {
var targetOffset = that.offset().top-10;
$('html,body').eq(0).animate({scrollTop: targetOffset}, speed || 500, callFunc);
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment