robin-dela / flowmap-effect

Mouse Flowmap Deformation with OGL
https://tympanus.net/Development/FlowmapDeformation/
99 stars 27 forks source link

Mobile functionality / Enable only while hovering over the specific canvas #4

Open marianssen opened 2 years ago

marianssen commented 2 years ago

Hi!

I really love your plugin, and I'm trying to implement it a a full website with other content as well. Desktop version works just fine, since the user can easily scroll. However, on mobile, the scroll is over-ridden by the javascript, so the user is not able to scroll the website at all.

My question is - what do you think would be the easiest way to fix this? Would it be possible to track the mouse position only inside a certain div?

marianssen commented 2 years ago

Nevermind, I got it working by changing the window parameter in lines:

window.addEventListener("touchstart", updateMouse, false);
window.addEventListener("touchmove", updateMouse, { passive: false });
window.addEventListener("mousemove", updateMouse, false);