1. 引入js库 (js下载地址:https://github.com/SortableJS/Sortable)

<script src="/static/js/sortable.min.js"></script>

2. 拖拽的使用

      /**
       * 图片拖拽函数(先允许图片拖拽,然后在上传的时候再去对比数据)
       * @param imageElementName
       * @param imageData
       */
      function draggingAndPulling(imageElementName) {
          // 图片拖拽
          var imageElement = document.getElementById(imageElementName); // 要拖拽的div的名称
          if (imageElement != null) {
              new Sortable(imageElement, {});
          }
      }

3. 拖拽其实并不难,难的是对拖拽之后的图片进行排序,然后再保存到数据库中进行存储,这个就要视情况而定了。

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2021-10-14
  • 2021-06-27
  • 2019-01-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案