Skip to content

Instantly share code, notes, and snippets.

@alordiel
Created May 25, 2017 06:45
Show Gist options
  • Save alordiel/97be2c680a1a4f09f87798aac3c62262 to your computer and use it in GitHub Desktop.
Save alordiel/97be2c680a1a4f09f87798aac3c62262 to your computer and use it in GitHub Desktop.
JS - scroll to top function that accepts selector element for offset from top
function scrollToPlace(selector,scrollTime,additionalToOffset) {
jQuery('html, body').animate({
scrollTop: jQuery(selector).offset().top - additionalToOffset
}, scrollTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment