Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions jquery.filedrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,38 +71,41 @@
files_count = 0,
files;

if ( opts.fallback_dropzoneClick === true )
if ( opts.fallback_id )
{
$('#' + opts.fallback_id).css({
display: 'none',
width: 0,
height: 0
});
}

this.on('drop', drop).on('dragstart', opts.dragStart).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave);
$(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave);

if ( opts.fallback_dropzoneClick === true )
{
if ( this.find('#' + opts.fallback_id).length > 0 )
if ( opts.fallback_dropzoneClick === true )
{
throw "Fallback element ["+opts.fallback_id+"] cannot be inside dropzone, unless option fallback_dropzoneClick is false";
$('#' + opts.fallback_id).css({
display: 'none',
width: 0,
height: 0
});
}
else

if ( opts.fallback_dropzoneClick === true )
{
this.on('click', function(e){
$('#' + opts.fallback_id).trigger(e);
});
if ( this.find('#' + opts.fallback_id).length > 0 )
{
throw "Fallback element ["+opts.fallback_id+"] cannot be inside dropzone, unless option fallback_dropzoneClick is false";
}
else
{
this.on('click', function(e){
$('#' + opts.fallback_id).trigger(e);
});
}
}

$('#' + opts.fallback_id).change(function(e) {
opts.drop(e);
files = e.target.files;
files_count = files.length;
upload();
});
}

$('#' + opts.fallback_id).change(function(e) {
opts.drop(e);
files = e.target.files;
files_count = files.length;
upload();
});
this.on('drop', drop).on('dragstart', opts.dragStart).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave);
$(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave);

function drop(e) {
if( opts.drop.call(this, e) === false ) return false;
Expand Down