scratchie icon indicating copy to clipboard operation
scratchie copied to clipboard

problem offset with scroll

Open keulu opened this issue 7 years ago • 0 comments

You have an issue when you scroll on your page, you don't calculte the value of the Main window scroll.

you can fix it by applying this path

in function getMouse()

add scrollOffset :

var top = window.pageYOffset || document.documentElement.scrollTop, left = window.pageXOffset || document.documentElement.scrollLeft;

and calculate the good position

mx = (e.pageX || e.touches[0].clientX) - offsetX + left;
my = (e.pageY || e.touches[0].clientY) - offsetY + top;

keulu avatar Jun 16 '17 08:06 keulu