Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 945 Bytes

File metadata and controls

30 lines (20 loc) · 945 Bytes

Fast Clicks

Activate clicks on mousedown to save at least ~100ms in response times. This being a pointer trick, it does not apply to touch devices.

// Option 1 (recommended): include in your build.
// No configuration options
import 'vpweb/fast';
<!-- Option 2: load as stand-alone script -->
<script src="dist/fast.min.js"></script>
  • Any anchor (<a>) in a block with the .vp-fast class or with the class directly will trigger early on mousedown.

  • Any button or submit input element with the .vp-fast class, or in a form with the .vp-fast class, will trigger early on mousedown.

function preclick(el)

Manually make an element trigger clicks on mousedown events. Prevents double-firing by tracking mousedown state.

Parameters:

  • elHTMLElement — Element to monitor