模态内的拖放区

Dropzone inside of modal

我尝试在模态 (Clarity-UI) 内初始化 Dropzone,但无法初始化。

CodePen Demo

注意: I 运行 modal as manual with this code:

   $('.js-upload-file-btn').on('click',function () {
        $(".js-upload-file, .modal-backdrop").addClass("open");
    });

    // close all modal
    $(document).on('click','.modal .close',function () {
        $(".modal, .modal-backdrop").removeClass("open");

    });

刚刚将您的 html 代码更改为这个并且有效:

 <!-- Modal Backdrop for all -->
<div class="modal-backdrop" aria-hidden="true"></div>

<!--Modal Create Folder -->
<div class="modal js-upload-file">
    <div class="modal-dialog" role="dialog" aria-hidden="true">
        <div class="modal-content">
           <!--<form action="">     // it should remove--> 
            <div class="modal-header">
                <a aria-label="Close" class="close">
                    <clr-icon aria-hidden="true" shape="close"></clr-icon>
                </a>
                <h3 class="modal-title">Upload</h3>
            </div>
            <div class="modal-body">

                <form id="dropzone" action="/" class="dropzone" method="post" enctype="multipart/form-data">
                    <div class="fallback">
                        <input name="file" type="file" multiple />
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button class="btn btn-success" type="button">Save</button>
            </div>
           <!--</form> // it should remove-->
        </div>
    </div>
</div>

注意:可能需要自定义更改才能使其正常工作。您使用了两个 <form> 标签作为嵌套