HTML5 drag and drop to move a div anywhere on the screen? -
The title is very self explanatory.
I've found that all the demos included in a div are included at a certain location. I need to create a dragable diva which can be left anywhere on the screen.
Is it possible to do with HTML5? If not, how should I do this?
This is actually quite straightforward:
-
Draft Calculate the offset of that dragable element in the event and the offset that is clicked at the top left corner
- Make sure
dragover is the event
drop event , Use the offset calculated with
clientX and
where I drop to know the status of the position For the clientY bonus issue, you have the upper and left position of the elements Can update the asset, it is not useful if you move went plot the elements allowing the pull.
- Make sure
Comments
Post a Comment