node package manager


Shims drag-drop events for mobile webkit browsers (iOS).

iOS shim for HTML 5 drag'n'drop

The HTML 5 drag'n'drop API allows you to implement drag'n'drop with the same code on most desktop browsers. Unfortunately, you'll notice iOS doesn't support it, so no iPad (or Android) action for you!

Luckily, WebKit gives us enough tools to shim seamlessly. If you drop this script in your page your existing HTML 5 drag'n'drop code should just work.


Check out the demo to see it in action. It also works on Android.


If you want enter/over/leave events, add a config object to the page before you include the shim.

var iosDragDropShim = { enableEnterLeave: true }
<script src="vendor/ios-drag-drop.js"></script>

If you want to the user to hold to drag, add a config object to the page before you include the shim.

var iosDragDropShim = { holdToDrag: 300 } //Adds 300ms delay before draging
<script src="vendor/ios-drag-drop.js"></script>

Known issues

iOS10 introduced a regression on touchmove handling where event.preventDefault() is not respected.

If you run into a situation where dragging and scrolling occur simultaneously apply the fix mentioned in #77.

Shim behaviour

  • all drag events, with dragenter, dragover and dragleave enabled via config flag
  • creates a partially transparent drag image based on the dragged element


To the amazing contributors who've provided massive extensions and fixes to the original.

@rem - who created the original demo used to demo this shim's drop-in nature.


MIT License