file-selector.js: allow file dropping anywhere
This commit is contained in:
parent
745bdc2b6c
commit
0e805c25d8
@ -108,7 +108,7 @@ var dropHandlers = {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (dragCounter === 0) $(this).addClass('dragover');
|
if (dragCounter === 0) $('.dropzone').addClass('dragover');
|
||||||
dragCounter++;
|
dragCounter++;
|
||||||
},
|
},
|
||||||
dragover: function (e) {
|
dragover: function (e) {
|
||||||
@ -121,13 +121,13 @@ var dropHandlers = {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
dragCounter--;
|
dragCounter--;
|
||||||
if (dragCounter === 0) $(this).removeClass('dragover');
|
if (dragCounter === 0) $('.dropzone').removeClass('dragover');
|
||||||
},
|
},
|
||||||
drop: function (e) {
|
drop: function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$(this).removeClass('dragover');
|
$('.dropzone').removeClass('dragover');
|
||||||
dragCounter = 0;
|
dragCounter = 0;
|
||||||
|
|
||||||
var fileList = e.originalEvent.dataTransfer.files;
|
var fileList = e.originalEvent.dataTransfer.files;
|
||||||
@ -139,7 +139,7 @@ var dropHandlers = {
|
|||||||
|
|
||||||
|
|
||||||
// attach handlers
|
// attach handlers
|
||||||
$(document).on(dropHandlers, '.dropzone');
|
$(document).on(dropHandlers);
|
||||||
|
|
||||||
$(document).on('click', '.dropzone .remove-btn', function (e) {
|
$(document).on('click', '.dropzone .remove-btn', function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
Loading…
Reference in New Issue
Block a user