Skip to content

Instantly share code, notes, and snippets.

View valfirst's full-sized avatar

Valery Yatsynovich valfirst

View GitHub Profile
@valfirst
valfirst / native_js_drag_and_drop_helper.js
Last active March 29, 2022 17:56 — forked from douglaslise/native_js_drag_and_drop_helper.js
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_START: 'dragstart',
MOUSEOVER: 'mouseover',
DROP: 'drop',
DRAG_END: 'dragend'
}
function createCustomEvent(type) {
var event = document.createEvent('CustomEvent')