jquery-draggable-touch
jquery-draggable-touch copied to clipboard
position:absolute, position:relative
Hey, thanks for sharing this. It was exactly what I needed. I'm a bit of a front end newbie, but I wanted to mention a couple of issues I ran into.
Initially I wasn't setting the position property in the CSS of my draggable so setting top and left inside the touchmove event handling was doing nothing.
https://github.com/heyman/jquery-draggable-touch/blob/56127d76438e9cc344f0adabb88b9c289e3c462b/jquery.draggableTouch.js#L93
It looks like the jQueryUI draggable code sets "position:relative" for you if the position property is unset.
Also, it appears your code assumes "position:absolute". I ended up modifying your code to work with "position:relative" because I wanted to be consistent with jQueryUI and because my draggable was inside a flexbox and flexbox children cannot have "position:absolute" from what I've read.