Skip to content

Instantly share code, notes, and snippets.

@GianlucaGuarini
Created June 18, 2015 13:08
Show Gist options
  • Save GianlucaGuarini/2f2ed8854975a959ba81 to your computer and use it in GitHub Desktop.
Save GianlucaGuarini/2f2ed8854975a959ba81 to your computer and use it in GitHub Desktop.
scroll-to.js
var scrollTo = function(el) {
$('html, body').animate({
scrollTop: el instanceof $ ? el.offset().top : typeof el === 'number' ? el : $('#' + el).offset().top
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment