Fastclick for Quasar Framework
This is a fork of the original Fastclick and is being used and maintained by Quasar Framework.
This is injected only for iOS platform (PWA or Cordova) and assumes you're already on that platform.
FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a
click event on mobile browsers. The aim is to make your application feel less laggy and more responsive while avoiding any interference with your current logic.
- iOS 7+ platform, on a Quasar PWA or Quasar Cordova
Ignore certain elements with
Sometimes you need FastClick to ignore certain elements. You can do this easily by adding the
Ignored by FastClick
Use case 1: non-synthetic click required
Internally, FastClick uses
document.createEvent to fire a synthetic
click event as soon as
touchend is fired by the browser. It then suppresses the additional
click event created by the browser after that. In some cases, the non-synthetic
click event created by the browser is required, as described in the triggering focus example.
This is where the
needsclick class comes in. Add the class to any element that requires a non-synthetic click.
Use case 2: Twitter Bootstrap 2.2.2 dropdowns
Another example of when to use the
needsclick class is with dropdowns in Twitter Bootstrap 2.2.2. Bootstrap add its own
touchstart listener for dropdowns, so you want to tell FastClick to ignore those. If you don't, touch devices will automatically close the dropdown as soon as it is clicked, because both FastClick and Bootstrap execute the synthetic click, one opens the dropdown, the second closes it immediately after.
FastClick is designed to cope with many different browser oddities. Here are some examples to illustrate this:
- basic use showing the increase in perceived responsiveness
- triggering focus on an input element from a
- input element which never receives clicks but gets fast focus
Credits and collaboration
The forked Fastclick is maintained by Razvan Stoenescu. Original contributors: Rowan Beentje, Matthew Caruana Galizia and Matthew Andrews at FT Labs. All open source code released by FT Labs is licensed under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.