单击FireFox

时间:2015-07-27 22:30:43

标签: dropzone.js

我试图解决问题,但我不能。 将文件上传到FireFox时我无法上传, 但文件将上传到Opera好。 沿着Dropzone.js我使用bootstrap和jquery作为库。

在我看来,问题是addEventListener? 使用firebug的示例视频:enter link description here

段:

Dropzone.options.myDropzone = {

		// Prevents Dropzone from uploading dropped files immediately
		autoProcessQueue: false,
		parallelUploads: 10,
		thumbnailWidth: 120,
		thumbnailHeight: 120,
		init: function() {

			var submitButton = document.querySelector("#submit-all");
			var myDropzone = this;

				submitButton.addEventListener("click", function() {
			  		myDropzone.processQueue(); // Tell Dropzone to process all queued files.
			  	});

			    this.on("addedfile", function(file) {
			        // Create the remove button
			        var removeButton = Dropzone.createElement("<button class='btn btn-xs btn-warning'>Remove file</button>");

			        // Listen to the click event
			        removeButton.addEventListener("click", function(e) {
			          // Make sure the button click doesn't submit the form:
			          e.preventDefault();
			          e.stopPropagation();

			        // Remove the file preview.
			        myDropzone.removeFile(file);
			        //   // If you want to the delete the file on the server as well,
			        //   // you can do the AJAX request here.
			        });

			        // Add the button to the file preview element.
			        file.previewElement.appendChild(removeButton);
				});
				
		} //dropzone init
	}; //dropzone options
<script src="https://raw.githubusercontent.com/enyo/dropzone/master/dist/dropzone.js"></script>

<form action="upload/do_upload" class="dropzone" id="my-dropzone"></form>
<button type="button" class="btn btn-primary"><span id="submit-all">Submit all files</span></button>
<button type="button" class="btn btn-default"><a href="upload">Reset</a></button>

1 个答案:

答案 0 :(得分:0)

这里有一个SPAN id =&#34; submit-all&#34;

<button type="button" class="btn btn-primary"><span id="submit-all">Submit all files</span></button>

然后你有一个querySelector:

var submitButton = document.querySelector("#submit-all");

按钮有一个点击事件,而不是跨度。也许如果你改变第一行,它应该工作:

<button type="button" id="submit-all" class="btn btn-primary"><span>Submit all files</span></button>

尝试一下,让我们知道。