Created
October 22, 2012 04:09
-
-
Save parrfolio/3929589 to your computer and use it in GitHub Desktop.
Basic Touch Drag and Drop
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
node.addEventListener("touchmove", function(event){ | |
// Only deal with one finger | |
if(event.touches.length == 1){ | |
// Get the information for finger #1 | |
var touch = event.touches[0], | |
// Find the style object for the node the drag started from | |
style = touch.target.style; | |
// Position the element under the touch point | |
style.position = "absolute"; | |
style.left = touch.pageX + "px"; | |
style.top = touch.pageY + "px"; | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment