在创建新的之前删除dropzone

时间:2013-08-29 16:44:57

标签: jquery jquery-ui jquery-plugins drag-and-drop dropzone.js

我的HTML

<ul id="sortable" class="ui-sortable">
    <li class="instruction_step" id="slid_1">
        <p class="sort">1</p>
        <div contenteditable="true" class="description">Some step</div>
        <div class="step_image" id="img_1" style="background: url(/templates/1.jpg) 0 0 no-repeat; background-size: 300px;"></div>
    </li>
    <li class="instruction_step" id="slid_2">
        <p class="sort">2</p>
        <div contenteditable="true" class="description">another step</div>
        <div class="step_image" id="img_2" style="background: url(/templates/2.jpg) 0 0 no-repeat; background-size: 300px;"></div>
    </li>
    <li class="instruction_step" id="slid_3">
        <p class="sort">3</p>
        <div contenteditable="true" class="description">some another step</div>
        <div class="step_image" id="img_3" style="background: url(/templates/3.jpg) 0 0 no-repeat; background-size: 300px;"></div>
    </li>
</ul>

我的js

$("#sortable").on("dblclick", "li", function (event) {
    $("#sortable li.editing").each(function (index) {
        $(this).removeClass('editing');
        $(this).find(".step_image").removeClass('dz-clickable');
    });
    $(this).addClass('editing');
    var img_id = $(this).find(".step_image").attr('id');
    var myDropzone = new Dropzone("#" + img_id + "", {
        url: "/upload/url?" + img_id,
        previewsContainer: "#previews",
        clickable: "#" + img_id + ""
    });
    $(this).find(".description").focus();
});

我有jqueryui可排序,当我dbclick它我可以编辑里面的数据,我可以在contenteditable div中写文本和上传图像(与DROPZONE.JS),但有图像上传它的问题,我想要删除myDropzone,因为它创建更多的这一点,所以在创建新的之前我想删除它

0 个答案:

没有答案