Skip to content

Make a DOM element draggable via mouse or touch and optionally constrain it to remain in another DOM element.

Notifications You must be signed in to change notification settings

vispo/DragElement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DragElement

DragElement by Jim Andrews, 2/18/2021

You are free to use this code as you please. However, if you find
any bugs in it, please fix them, let me know (jim@vispo.com), and 
make the fix available. 

DragElement(aElement, aCage) 

    * Constructs an object that makes aElement draggable (mouse or touch). 
    * aElement is the element (or its id) that becomes draggable. 
    * aCage is is an optional element (or its id) that aElement stays within. 
    * aCage does not have to be the parent of aElement.
    * The CSS position property of aElement cannot be static (the default value).
    * See the included HTML file for usage.
    * Tested on iOS, Android, Windows, and Mac browsers.

About

Make a DOM element draggable via mouse or touch and optionally constrain it to remain in another DOM element.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published