I'm listening to the mousemove event to give a button a nice effect based on the mouse position. On mobile however, if I touch the button the event is fired aswell making the button jump to the position. I'd rather have the button ignore the event when it's done by touch but I'm struggling to understand how this can be achieved?
// The function is just a helper of mine (it ads addEventListener to the matched events
createEventListener('.hoverable', 'mousemove', function(e) {
// stripped out some calculations for simplicity reasons
const deltaX = 50;
const deltaY = 50;
const transformString = `translate3d(${deltaX}px, ${deltaY}px, 0)`;
this.style.mozTransform = transformString;
this.style.webkitTransform = transformString;
this.style.transform = transformString;
});