Skip to content

Detecting Touch Devices

Srdjan Djenader edited this page Dec 21, 2017 · 2 revisions

Specifies the function that DrawerJs calls to determine whether it's running on a touch device.


Configuration

detectTouch: function() {
    // Your code goes here
}

  • This function must return true or false.
  • If the function returns true, DrawerJs assumes it runs on a touch device and will …
    • adjust its toolbar size (see property toolbarSizeTouch)
    • adjust its context menu size
    • use touch-optimized settings for object control (see property objectControlsTouch)
    • add touch events
  • If this function is not specified explicitly, DrawerJs will use its own touch detection mechanism.

Disabling Touch Detection

To disable touch detection entirely, simply return false from the detectTouch function:

detectTouch: function() {
    return false;
}
Clone this wiki locally