From 0e805c25d8f3044a2c6640a1e8818d3774a0ff07 Mon Sep 17 00:00:00 2001 From: czaks Date: Tue, 31 Mar 2015 07:20:53 +0200 Subject: [PATCH] file-selector.js: allow file dropping anywhere --- js/file-selector.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/file-selector.js b/js/file-selector.js index 6aad9382..207a5ae9 100644 --- a/js/file-selector.js +++ b/js/file-selector.js @@ -108,7 +108,7 @@ var dropHandlers = { e.stopPropagation(); e.preventDefault(); - if (dragCounter === 0) $(this).addClass('dragover'); + if (dragCounter === 0) $('.dropzone').addClass('dragover'); dragCounter++; }, dragover: function (e) { @@ -121,13 +121,13 @@ var dropHandlers = { e.preventDefault(); dragCounter--; - if (dragCounter === 0) $(this).removeClass('dragover'); + if (dragCounter === 0) $('.dropzone').removeClass('dragover'); }, drop: function (e) { e.stopPropagation(); e.preventDefault(); - $(this).removeClass('dragover'); + $('.dropzone').removeClass('dragover'); dragCounter = 0; var fileList = e.originalEvent.dataTransfer.files; @@ -139,7 +139,7 @@ var dropHandlers = { // attach handlers -$(document).on(dropHandlers, '.dropzone'); +$(document).on(dropHandlers); $(document).on('click', '.dropzone .remove-btn', function (e) { e.stopPropagation();