SimpleDrag - a very tiny library
Note: This little library still works great. However, it is getting a bit old.
jQuery to deal with
browser incompatibilities and such. Having said that, if you're looking for a small, lightweight utility,
by all means, give SimpleDrag a try!
-Dave (Jan 1, 2011)
A Quick Example
Click here to see a tiny SimpleDrag example.
How to Use
First, grab simpledrag.js.
Then, include it in your page like so:
Finally, make the HTML element of your choice (such as a <div> tag) draggable by assigning dragDown to its onmousedown event like so:
After assigning dragDown() to the onmousedown event of moveme, everything else is automatic. When the user presses the mouse over the moveme object, the dragDown function is called, the other event handlers are created by dragMakeMoveFunc() and dragMakeStopFunc(). When the user releases the mouse, the onmousemove event handler is removed and the object stops moving. That's it!