sortable.js 的研究

曹石 2024-05-26 20:48 15次浏览 0 条评论 taohigo.com

Sortable —是一個JavaScript庫,用於在現代瀏覽器和觸摸設備上對拖放列表進行重新排序。無需jQuery。支持Meteor,AngularJS,React,Polymer,Vue,Ember,Knockout和任何CSS庫,例如Bootstrap。https://sortablejs.github.io/Sortable/

demo 網站 http://sortablejs.github.io/Sortable/

一看這解釋感覺就是很棒的感覺

特征

  • 支持觸摸設備和現代瀏覽器(包括IE9)
  • 可以從一個列表拖動到另一個列表或在同一列表內
  • 移動項目時的CSS動畫
  • 支持拖動手柄和可選文本(比voidberg的html5sortable更好)
  • 智能自動滾動
  • 高級交換檢測
  • 流暢的動畫
  • 多拖動支持
  • 支持CSS轉換
  • 使用原生HTML5拖放API構建
  • 支持
    • Meteor
  • Angular
    • 2.0+
    • 1.*
  • React
    • ES2015+
    • Mixin
  • Knockout
  • Polymer
  • Vue
  • Ember
  • 支持任何CSS庫,例如Bootstrap
  • 簡單的API
  • 支持插件
  • CDN
  • 不需要jQuery(但有支持)
  • 打字稿定義在 @types/sortablejs

文章

  • Dragging Multiple Items in Sortable (April 26, 2019)
  • Swap Thresholds and Direction (December 2, 2018)
  • Sortable v1.0 — New capabilities (December 22, 2014)
  • Sorting with the help of HTML5 Drag'n'Drop API (December 23, 2013)

安裝

npm install sortablejs --save