How can I implement a touch-sensitive, responsive, sortable list supporting drag & drop for Bootstrap?

前端 未结 2 1035
梦谈多话
梦谈多话 2020-12-22 18:06

I have a

    list that I want to make sortable (drag & drop). How can I get it to work with Bootstrap 3 in modern browsers and touch devices?

    <
2条回答
  •  悲哀的现实
    2020-12-22 18:51

    The answers posted before this one are surprisingly outdated.

    rubaxa-sortable is a fast, no-dependencies, small reorderable lists widget with touch support that works with the HTML5 native drag&drop API. You can use it with Bootstrap, Foundation, or any CSS library you want, and instantiating it only takes one line.

    It supports reordering within a list or across lists. You can define lists that can only receive elements, or lists from which you can drag, but onto which you cannot drop. It's also very actively maintained and MIT licensed on GitHub.

    new Sortable(document.getElementsByClassName('sortable')[0]);
    
    
    
    
    
    
    
    • This is Sortable
    • It works with Bootstrap...
    • ...out of the box.
    • It has support for touch devices.
    • Just drag some elements around.

提交回复
热议问题