Skip to content

Instantly share code, notes, and snippets.

@jwmao
jwmao / .block
Created October 20, 2017 15:25
fresh block
license: mit
@jwmao
jwmao / .block
Created October 20, 2017 15:25
fresh block
license: mit
@jwmao
jwmao / .block
Last active October 20, 2017 15:27
directed graph
license: mit
@jwmao
jwmao / README.md
Created June 6, 2017 16:21 — forked from thudfactor/README.md
Drag from HTML, Drop to SVG

This demonstrates dragging from HTML to SVG elements, which can be tricky because of the differences between SVG and HTML DOMs. JQueryUI has a nice API for handling drag and drop, including defining the appearance of a dragged object and providing start, drag, and stop events. Unfortunately, JQueryUI's "drop" does not work at all on SVG elements inside the SVG tag, although it does appear to work on the SVG tag itself.

To get over this limitation, we create a custom Drag/Drop manager, and use the start, drag, and stop events for the dragged elements in conjunction with mouseover and mouseout events on the SVG elements to determine whether or not a "drop" has been dropped on a legal SVG element.

@jwmao
jwmao / .block
Created June 5, 2017 14:29
fresh block
license: mit
@jwmao
jwmao / .block
Last active June 5, 2017 15:50
dr
license: mit
@jwmao
jwmao / .block
Last active September 29, 2016 22:50
responsive on window resize
license: gpl-3.0
@jwmao
jwmao / .block
Last active September 29, 2016 22:29
responsive on windows resize
license: gpl-3.0