首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dropzone预览不在预览区中显示

Dropzone预览不在预览区中显示
EN

Stack Overflow用户
提问于 2016-01-17 08:02:39
回答 1查看 3.3K关注 0票数 0

我正在使用Matias Meno的教程将dropzone实现到表单中:https://github.com/enyo/dropzone/wiki/Combine-normal-form-with-Dropzone

预览无法在预览区div中正确显示,我不确定原因。

HTML:

代码语言:javascript
复制
      <form id="my-awesome-dropzone" action="/uploads" class="dropzone">
            <fieldset name="contact-form-fieldset">
                <legend><h1>Request Services</h1></legend>
                <ul>
                    <li class="contact-form-fieldset-title">Full Name</li>
                    <li><input type="text" name="name" id="contact-form-name" class="plain buffer"></li>
                    <li class="contact-form-fieldset-title">
                    <li class="contact-form-fieldset-title">Email</li>
                    <li><input type="email" name="email" id="contact-form-email" class="plain buffer"></li>
                    <li class="contact-form-fieldset-title">Phone</li>
                    <li><input type="text" name="phone" id="contact-form-phone" class="plain buffer"></li>
                    <li class="contact-form-fieldset-title">Describe the problem with your device</li>
                    <li>
                        <textarea class="plain buffer" id="styled" name="styled-textarea"></textarea>
                    </li>
                    <li>
                          <div class="dropzone-previews"></div> <!-- this is were the previews should be shown. -->
                    </li>
                </ul>
                <div id="contact-form-fieldset-button">
                <button type="submit">Submit data and files!</button>
                </div>
            </fieldset>
            <p>In a hurry? Call 632-345-674</p>
        </form>
代码语言:javascript
复制
     <script src="../js/dropzone.js"></script>
     <script src="../js/uploader.js"></script>

uploader.js文件包含Matias的原始代码:

代码语言:javascript
复制
Dropzone.options.myAwesomeDropzone = { // The camelized version of the ID of the form element

// The configuration we've talked about above
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,

  // The setting up of the dropzone
init: function() {
  var myDropzone = this;

// First change the button to actually tell Dropzone to process the queue.
this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
  // Make sure that the form isn't actually being sent.
  e.preventDefault();
  e.stopPropagation();
  myDropzone.processQueue();
});

// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
  // Gets triggered when the form is actually being sent.
  // Hide the success button or the complete form.
});
this.on("successmultiple", function(files, response) {
  // Gets triggered when the files have successfully been sent.
  // Redirect user or notify of success.
});
this.on("errormultiple", function(files, response) {
  // Gets triggered when there was an error sending the files.
  // Maybe show form again, and notify user of error
}); }}

有人有什么建议吗?

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2016-12-28 18:47:02

试试previewsContainer:".dropzone-previews“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34833551

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档