Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dropzone.js and jquery version compatibility

I've been using dropzone.js in some projects recently and configuring options without no problem, but in a new project I was using a recent version of jQuery (3.1.0) auto-installed by Zend Framework 3 and it appears to cause some kind of conflict with dropzone.js version 4.3.0.

I was not able to configure options for my dropzone, it is always using default options.

like image 745
jairusgr Avatar asked Oct 06 '16 07:10

jairusgr


1 Answers

If anyone else needs to use Dropzone with jQuery 3, particularly if you need to reference jQuery methods within Dropzone's callbacks, here's what worked for me:

// Do this outside of jQuery
Dropzone.autoDiscover = false;

// Start jQuery stuff
$(function() {

    // Call Dropzone manually
    $("#dropzone").dropzone({
        paramName: "image",
        maxFilesize: 8, // MB
        queuecomplete: function() {
            // Some more jQuery stuff inside Dropzone's callback
            $("#some_id").somejQueryMethod();
        }
    });

});
like image 69
MrCarrot Avatar answered Sep 17 '22 04:09

MrCarrot