最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - dropzone.js programmatically doesn't work - Stack Overflow

programmeradmin1浏览0评论

I am trying create drop zones programmatically, but it doesn't work.

HTML Code:

<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!

best regards :)

I am trying create drop zones programmatically, but it doesn't work.

HTML Code:

<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!

best regards :)

Share Improve this question asked Aug 6, 2014 at 5:08 João ManoloJoão Manolo 2451 gold badge5 silver badges14 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 19

You need to give your #myDropZone div some width and height so that it takes up space. Heres a jsfiddle.

Alternatively, you can add the dropzone class to your div to get the default styling that you see in the demos. Heres the jsfiddle for that.

Add class dropzone to the div element which holds your drop zone. Hope that you have added the dropzone stylesheet to your page.

发布评论

评论列表(0)

  1. 暂无评论