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 onmousedown
instead of the browser'smouseup
. Limited to anchors withhref
to avoid side effects from theclick
event triggering twice. -
Submit inputs/buttons with
vp-fast
attribute, or in forms withvp-fast
, trigger onmousedown
. Limited to[type=submit]
because of the doubleclick
triggering.
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:
el
—HTMLElement
— Element to monitor