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;
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