onDrag

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.on

Detect drag “gesture” with the mouse or touch

Params

  1. $elm*-HTMLElement

    The HTMLElement on which to detect the swipe

  2. cb*-Function

    The function to call on swipe. The callback function has as parameter an object that containthe swipe direction like left, right, up and down

  3. threshold100Number

    The swipe threshold

Example

import { onDrag } from '@blackbyte/sugar/dom'
onDrag($elm, (drag) => {
  // do something...
});

Settings

  1. maxSpeed0.01Number

    The maximum speed

Todo

  • testsnormal