Created
November 15, 2016 05:36
-
-
Save ChangJoo-Park/d6aa54523b2e8b9e4d32b9ee362644cc to your computer and use it in GitHub Desktop.
특정 엘리먼트의 맨 위로 스크롤할 수 있도록 함
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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