Comments (4)
This code works well for the devices I could get hands on. Hope it helps!
// Set the default
touchable = true,
touches = []; // array of touch vectors;
// TODO: quite fragile; find a better check for touch-ability as the Web standards evolve
try {
document.createEvent('TouchEvent'); }
catch (err) {
touchable = false;
}
from zerobot.
Is it really necessary to detect touch ability? Is there any harm by reacting both on mouse and touch events at the same time? If you have a touchscreen computer, you should be able to use both touches and mouse without switching anything.
OK, I've updated the html file. @oskar456 was right, it's not necessary to check for a touchscreen. Both sets of functions can be used simultaneously. So far I have tested the new code on Chrome(with touchscreen and mouse), Edge, Android, Chrome for Android and on iOS without any problems.
I also tried what @ilyabelkin suggested, but somehow it didn't work for me at all.
Thank you all for your help!
from zerobot.
Thank you very much for bringing this to my attention and for providing a fix. I haven't noticed any problems yet, mostly because I'm using Chrome on PC or iOS for testing, which still support the feature. I will definitely look into it.
from zerobot.
Is it really necessary to detect touch ability? Is there any harm by reacting both on mouse and touch events at the same time? If you have a touchscreen computer, you should be able to use both touches and mouse without switching anything.
from zerobot.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zerobot.