From 891565f76c3e4947eca4194bd0be7997b87011a0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Mar 2023 16:47:00 +0000 Subject: [PATCH] =?UTF-8?q?*=20unn=C3=B6tige=20preventDefault()=20entfernt?= =?UTF-8?q?=20*=20optisches=20Klick-Feedback=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/script.js b/script.js index 5e6c2cc..5fc094a 100644 --- a/script.js +++ b/script.js @@ -1,22 +1,28 @@ dropzone = document.getElementById('dropzone'); dropzone.addEventListener('dragover', function(e) { - e.preventDefault(); - this.classList.remove('nodrop'); this.classList.add('drop'); }); dropzone.addEventListener('dragleave', function(e) { - e.preventDefault(); - this.classList.remove('drop'); this.classList.add('nodrop'); }); -dropzone.addEventListener('click', function(e) { - e.preventDefault(); +dropzone.addEventListener('mousedown', function(e) { + this.classList.remove('nodrop'); + this.classList.add('drop'); + console.log('click'); +}); +dropzone.addEventListener('mouseup', function(e) { + this.classList.remove('drop'); + this.classList.add('nodrop'); + console.log('unclick'); +}); + +dropzone.addEventListener('click', function(e) { input = document.createElement('input'); input.type = 'file'; input.click();