jairusgr
jairusgr

Reputation: 147

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.

Upvotes: 6

Views: 4441

Answers (3)

MrCarrot
MrCarrot

Reputation: 2768

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();
        }
    });

});

Upvotes: 6

Ali Sadri
Ali Sadri

Reputation: 1676

Afer half hour searching i found problem it works if declare befor

$(document).ready(function () {});

or

$(function () {...});

beacuse dropzone initiate befor jquery load methodes

Upvotes: 1

jairusgr
jairusgr

Reputation: 147

My solution, of course have been to come back to an older version of jQuery, which is enough for me (1.11.1).

Hope this helps, and if anyone knows the reason of the conflict, cool!

Regards

Upvotes: 0

Related Questions