-2

I want to detect if the user is holding a file, if he is i want to show a window that will take this file and move it to another folder.

The window itself i done, i just need to detect if the user has dragged a file (anywhere on the screen, i can't detect it on the window because the window isn't shown.), then show the window (with window.show()).

  • 1
    Hi, welcome to Stack Overflow. Please add information on what you have already tried as well as a Minimal, Reproducible Example: https://stackoverflow.com/help/minimal-reproducible-example Another thing - you can edit your question instead of adding comments to add information or clarify things – ArielGro Jan 21 '20 at 08:16

1 Answers1

0

Take a look at the drag events documentation for javascript

https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API#Drag_Events

Elements that are draggable, has the draggable=true property and an ondragstart event handler

from the documentation:

<script>
function dragstart_handler(ev) {
 // Add the target element's id to the data transfer object
 ev.dataTransfer.setData("text/plain", ev.target.id);
}
</script>

<p id="p1" draggable="true" ondragstart="dragstart_handler(event)">This element is draggable.</p>