working on a webgame with ThreeJS. On iOS, a longpress creates a small haptic vibration feedback after 0.5s have passed.
Since I'd like the user to be able to hold their finger down to walk around, this is a distraction.
I've already got preventDefault and stopPropagation in play for touchStart, touchEnd, touchMove, touchCancel, and contextMenu, what am I missing?
Each are implemented as such:
function onTouchStart(event) {
     event.preventDefault();
     event.stopPropagation();
     ...
Thanks!
Scroll down to “System Sound/Vibration Control.” The bottom section of toggles is for vibration. Toggle on or off any of the things you'd like to change.
Turn off all vibrations: Go to Settings > Accessibility > Touch, then turn off Vibration. Note: This setting turns off vibrations for earthquake, tsunami, and other emergency alerts.
It seems that you have to explicity select a container and attach the event handling to that cotainer.
HTML:
<body><div id="body">
    <div>
        test
    </div>
</div></body>
Javascript:
document.getElementById('body').addEventListener("touchstart", (e)=>{
    e.preventDefault();
    e.stopPropagation();
});
Example that works when attaching to the #body div : https://jsfiddle.net/gyfbh35t/2/
Example that does not work when attaching to the document: https://jsfiddle.net/gyfbh35t/3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With