Created
July 11, 2012 09:39
-
-
Save kenoir/3089313 to your computer and use it in GitHub Desktop.
For simulating drag drop events (not in IE).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Droop = function(){ | |
} | |
Droop.simulateDragStart = function(target){ | |
var e = new Event('mousedown'); | |
target.dispatchEvent(e); | |
} | |
Droop.simulateDrag = function(position){ | |
var e = new Event('mousemove'); | |
e.pageY = position.y; | |
e.pageX = position.x; | |
document.dispatchEvent(e); | |
} | |
Droop.simulateDrop = function(target){ | |
var e = new Event('mouseup'); | |
e.target = target; | |
document.dispatchEvent(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment