-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate into individual .js files
- Loading branch information
1 parent
f3aae30
commit 5d3bd5e
Showing
3 changed files
with
444 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const dropContainer = document.getElementById("dropcontainer"); | ||
const fileInput = document.getElementById("input-file"); | ||
|
||
dropContainer.addEventListener( | ||
"dragover", | ||
(e) => { | ||
// prevent default to allow drop | ||
e.preventDefault(); | ||
}, | ||
false | ||
); | ||
|
||
dropContainer.addEventListener("dragenter", () => { | ||
dropContainer.classList.add("drag-active"); | ||
}); | ||
|
||
dropContainer.addEventListener("dragleave", () => { | ||
dropContainer.classList.remove("drag-active"); | ||
}); | ||
|
||
dropContainer.addEventListener("drop", (e) => { | ||
e.preventDefault(); | ||
dropContainer.classList.remove("drag-active"); | ||
fileInput.files = e.dataTransfer.files; | ||
}); |
Oops, something went wrong.