Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Multiple drag n' drop for touch
<meta charset=utf-8 />
<title>Drag n' drop touch demo -</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />
<script class="jsbin" src=""></script>
<style type="text/css">
.draggable {
position: absolute;
left: 30px;
top: 30px;
width: 60px;
height: 60px;
margin-left: -30px;
margin-top: -30px;
color: #FFF;
font: bold 16px Helvetica,Arial,Sans-serif;
text-align: center;
background-color: #ABF;
border: 3px solid #669;
<div class="draggable">Drag me!</div>
<div class="draggable">Drag me!</div>
<script type="text/javascript">
var moveMe = function(e) {
var orig = e.originalEvent;
top: orig.changedTouches[0].pageY,
left: orig.changedTouches[0].pageX
$(".draggable").bind("touchstart touchmove", moveMe);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment