Is there a way to do drag-and-drop re-ordering of the preview elements in a dropzone.js instance?

后端 未结 3 1035
情歌与酒
情歌与酒 2021-02-02 14:41

I have a dropzone.js instance on a web page with the following options:

autoProcessQueue:false
uploadMultiple:true
parallelUploads:20
maxFiles:20
3条回答
  •  囚心锁ツ
    2021-02-02 15:25

    I've got it working now using jquery-ui's sortable. The trick was to make sure to use the 'items' option in sortable to pick only the dz-preview elements, because dropzone.js has the dz-message element along with the dz-preview elements in the main container. Here's how my code looks:

    The HTML:

    The script:

    $(function() {
        $("#image-dropzone").sortable({
            items:'.dz-preview',
            cursor: 'move',
            opacity: 0.5,
            containment: '#image-dropzone',
            distance: 20,
            tolerance: 'pointer'
        });
    })
    

提交回复
热议问题