dropzone.js and jquery version compatibility

2019-06-21 08:57发布

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.

3条回答
Melony?
2楼-- · 2019-06-21 09:10

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

查看更多
SAY GOODBYE
3楼-- · 2019-06-21 09:20

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

});
查看更多
何必那么认真
4楼-- · 2019-06-21 09:23

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

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

or

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

beacuse dropzone initiate befor jquery load methodes

查看更多
登录 后发表回答