hieptuanle / ios-html5-drag-drop-shim

A drop-in shim to allow you to use existing html5 drag'n'drop code with iOS

Home Page:http://timruffles.github.io/ios-html5-drag-drop-shim/enter-leave/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Demos

Check out the demo to see it in action. It should work on Android, but I don't have an Android phone to test. Let me know @timruffles.

Install/config

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

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

Shim behaviour

  • all drag events, with dragenter, dragover and dragleave enabled via config flag
  • as far as possible, moves dragged element to top of visual hierarchy
  • animated snap-back

Thanks

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.

License

MIT License

About

A drop-in shim to allow you to use existing html5 drag'n'drop code with iOS

http://timruffles.github.io/ios-html5-drag-drop-shim/enter-leave/

License:MIT License


Languages

Language:JavaScript 61.5%Language:CSS 38.5%