alekseykulikov / touch-action Goto Github PK
View Code? Open in Web Editor NEWDisable 300ms delay on mobile using CSS touch-action or asynchronously download FastClick as polyfill
License: MIT License
Disable 300ms delay on mobile using CSS touch-action or asynchronously download FastClick as polyfill
License: MIT License
I tried your implementation inside a scroll view and it worked really nice.
I didn't see much difference on a range slider inside a web app running on Android 8.2 on a Motorola G5.
Do you think you can improve it further?
Regards
Mobile browsers have a gesture known as double tap to zoom, and to make double tap to zoom work, browsers don’t fire a click event (or the various mouse events) until ~300 milliseconds after the user taps the screen. Simply put, without a delay browsers cannot differentiate between a “click” and the first half of a double tap.
https://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
FastClick (https://github.com/ftlabs/fastclick)
+ works everywhere - polyfilll
- applies to the whole page, blocks zoom
- additional 2.5 kb for every page, even on desktop
<meta name="viewport" content="width=device-width”>
(https://twitter.com/jaffathecake/status/702854158878183425)
+ works iOS 9.3+
- hard to check native support
- requires polyfill as fallback
- does not work in IE
CSS touch-action: manipulation
(https://github.com/alekseykulikov/touch-action)
+ works iOS 9.3+ and IE10 (ms-touch-action)
+ configurable
- works only with “clickable elements” (link, button)
- requires polyfill as fallback
<body>
modificationbutton:not(.needsclick), a[href]:not(.needsclick) {
touch-action: manipulation;
-ms-touch-action: manipulation;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.