convert-mouse-to-touch

Listen mousedown,mousemouse,mousedown event from window and covert those event to touch event and dispatch.

Usage no npm install needed!

<script type="module">
  import convertMouseToTouch from 'https://cdn.skypack.dev/convert-mouse-to-touch';
</script>

README

ConvertMouseToTouch

Usage

npm install convert-mouse-to-touch

UMD Support

const ConvertMouseToTouch = require('convert-mouse-to-touch');
ConvertMouseToTouch.init();

or

<script src="dist/index.js"></script>
<script>
  ConvertMouseToTouch.init();
</script>

Description

Listen mousedown,mousemouse,mousedown event from window and covert those event to touch event and dispatch to the event.target.

Feature

  • support chrome emulated devices (Won't trigger touchevent twice)
  • TouchEvent,Touch polyfill