1.0.1 • Published 2 years ago

@kmccullough/using-touch-layout v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

using-touch-layout

Adds one of two classes to body to indicate whether touch input is currently in use

Installation

$ npm install @kmccullough/using-touch-layout

Usage

window.usingTouchLayout = new UsingTouchLayout({
  classElement: undefined,        // Defaults to `document.body` 
  eventElement: undefined,        // Defaults to `document`
  onTouchActive: () => {},        // Called when touch active
  onNonTouchActive: () => {},     // Called when non-touch active
  onChange: isTouchActive => {},  // Called when non-touch/touch become active
  nonTouchActiveClass: undefined, // Defaults to `l-using-touch--non-touch`
  touchActiveClass: undefined,    // Defaults to `l-using-touch--touch`
});

License

MIT