Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 1 KB

fast.md

File metadata and controls

31 lines (19 loc) · 1 KB

Fast Clicks

Activate clicks on mousedown to save at least ~100ms in response times.

// 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>
  • Anchors in a block with the vp-fast attribute or with the attribute directly are triggered on mousedown instead of the browser's mouseup. Limited to anchors with href to avoid side effects from the click event triggering twice.

  • Submit inputs/buttons with vp-fast attribute, or in forms with vp-fast, trigger on mousedown. Limited to [type=submit] because of the double click triggering.

function preclick(el)

Manually make an element trigger clicks on mousedown events. Click event is fired twice, so be careful when adding this behavior to new elements.

Parameters:

  • elHTMLElement — Element to monitor