Skip to content
Advertisement

JavaScript How to Dynamically Move Div by Clicking and Dragging

Okay it would seem like it should be simple. I need to take an already existing div and move it according to mouse position within the window. I have searched everywhere and it has led me to over-complicated ways of doing the same thing and involves the use of j-query. I need to strictly use javascript for what I am trying to do.

Method :

JavaScript

Advertisement

Answer

I think you’re looking for something more like this

JavaScript

FIDDLE

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement