Skip to content

Instantly share code, notes, and snippets.

@ChangJoo-Park
Created November 15, 2016 05:36
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 ChangJoo-Park/d6aa54523b2e8b9e4d32b9ee362644cc to your computer and use it in GitHub Desktop.
Save ChangJoo-Park/d6aa54523b2e8b9e4d32b9ee362644cc to your computer and use it in GitHub Desktop.
특정 엘리먼트의 맨 위로 스크롤할 수 있도록 함
function findPos (obj) {
let curtop = 0
if (obj.offsetParent) {
do {
curtop += obj.offsetTop
obj = obj.offsetParent
} while (obj)
return [curtop]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment