Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Created December 18, 2017 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanhtran3005/ed05c6a939ae57eebd4c12b1dde61ddb to your computer and use it in GitHub Desktop.
Save khanhtran3005/ed05c6a939ae57eebd4c12b1dde61ddb to your computer and use it in GitHub Desktop.
A properly way to do scrollTop. It's correct for positive and negetive element's offsetY
var body = $('.modal-body');
body.animate({
scrollTop: body.scrollTop() + error.offset().top - 65
}, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment