Last active
March 9, 2018 08:44
-
-
Save umkasanki/4d01b214a14eb0d8b11ff8d31772466b to your computer and use it in GitHub Desktop.
jQuery offset of element in relation to viewport
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
photo = $('#photo') | |
offset = photo.offset() | |
photoViewportOffsetTop = offset.top - $(document).scrollTop() | |
photoViewportOffsetLeft = offset.left - $(document).scrollLeft() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment