javascript dropzone.js 以编程方式不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25152639/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dropzone.js programmatically doesn't work
提问by Jo?o Manolo
I am trying create drop zones programmatically, but it doesn't work.
我正在尝试以编程方式创建拖放区,但它不起作用。
HTML Code:
HTML代码:
<div class="content-wrap">
<div class="row">
<script type="text/javascript">
$(function() {
$("div#myDropZone").dropzone({
url : "/file-upload"
});
});
</script>
<div class="col-sm-12">
<div class="nest" id="DropZoneClose">
<div class="title-alt">
<h6>DropZone</h6>
</div>
<div class="body-nest" id="DropZone">
<div id="myDropZone" >
</div>
<button style="margin-top: 10px;" class="btn btn-info"
id="submit-all">Submit all files</button>
</div>
</div>
</div>
</div>
</div>
The drop zone in <div id="myDropZone">
not appers!
<div id="myDropZone">
不在的拖放区!
best regards :)
最好的祝福 :)
回答by go-oleg
You need to give your #myDropZone
div some width and height so that it takes up space. Heres a jsfiddle.
你需要给你的#myDropZone
div 一些宽度和高度,以便它占用空间。这是一个jsfiddle。
Alternatively, you can add the dropzone
class to your div to get the default styling that you see in the demos. Heres the jsfiddlefor that.
或者,您可以将该dropzone
类添加到您的 div 中以获得您在演示中看到的默认样式。继承人的jsfiddle了点。
回答by Ayesh Shaminda
Add class dropzone
to the div
element which holds your drop zone.
Hope that you have added the dropzone
stylesheet to your page.
将类添加dropzone
到div
包含您的拖放区的元素。希望您已将dropzone
样式表添加到您的页面。