Does anybody know how dragging objects (divs) around on the screen by mouse-click-and-hold implemented using pure JS? I am interested in the native JS functions and the technique which may be used.
Further, how can we do this using jquery?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can read Generic Drag article. It works with “pure” JavaScript.
However, I still recommend jQuery UI because it’s more feature-rich and probably cross-browser.
In jQuery UI this is easily done using $(‘#divId’).draggable();