dropzone.js和jquery版本兼容性 [英] dropzone.js and jquery version compatibility
问题描述
我最近在一些项目中使用了dropzone.js并且没有任何问题地配置选项,但是在一个新项目中,我使用了Zend Framework 3自动安装的最新版本的jQuery(3.1.0),它出现了与dropzone.js版本4.3.0发生某种冲突。
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.
我无法为我的dropzone配置选项,它始终使用默认选项。
I was not able to configure options for my dropzone, it is always using default options.
推荐答案
如果其他人需要在jQuery 3中使用Dropzone,特别是如果你需要在Dropzone的回调中引用jQuery方法,那么这对我有用:
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();
}
});
});
这篇关于dropzone.js和jquery版本兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!