LightRange.js icon indicating copy to clipboard operation
LightRange.js copied to clipboard

Scrolling not accounted for in x, y coords

Open swamikevala opened this issue 8 years ago • 2 comments

I'm using this library to make annotations to long articles. When I scroll the page down, the yStart and yEnd values are not adjusted to take the scrolling into account.

The values returned are relative to the visible screen. However I need them relative to the containing element. I suspect this would be a common use case.

swamikevala avatar Jan 09 '18 13:01 swamikevala

Found a fix: https://stackoverflow.com/questions/28633221/document-body-scrolltop-firefox-returns-0-only-js

const bodyScrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0

Note: I'm on Chrome v.63

swamikevala avatar Jan 09 '18 14:01 swamikevala

@swamikevala How did you integrate LightRange as a annotations? Can you share a little bit? Thank you.

quantrung9 avatar Oct 08 '18 09:10 quantrung9