Fix dragover class flickering issue

This commit is contained in:
Hadi Nategh 2019-08-28 16:14:53 +02:00
parent 12f3e9defd
commit 5877f3d0f1

View File

@ -231,8 +231,9 @@
loadFiles(e.dataTransfer.files, e);
}
};
var counterDrag = 0;
var onDragLeave = function(e){
e.currentTarget.classList.remove($.getOpt('dragOverClass'));
if (--counterDrag == 0) e.currentTarget.classList.remove($.getOpt('dragOverClass'));
};
var onDragOverEnter = function(e) {
e.preventDefault();
@ -241,7 +242,7 @@
e.stopPropagation();
dt.dropEffect = "copy";
dt.effectAllowed = "copy";
e.currentTarget.classList.add($.getOpt('dragOverClass'));
if (e.type == 'dragenter' && counterDrag++ === 0) e.currentTarget.classList.add($.getOpt('dragOverClass'));
} else { // not work on IE/Edge....
dt.dropEffect = "none";
dt.effectAllowed = "none";