Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
    <!-- Sortable v1.6.1/ -->
    <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.6.1/Sortable.min.js"></script>
</head>
<body>
    <div class="example">
        <ul id="items">
            <li class="item">li 1</li>
            <li class="ignore">li 2(ignore)</li>
            <li class="item">li 3</li>
            <li class="item">li 4</li>
        </ul>
    </div>
    <script>
        var el = document.getElementById( "items" );
        Sortable.create(el, {
            // 參數設定[註1]
            disabled: false, // 關閉Sortable
            animation: 150,  // 物件移動時間(單位:毫秒)
            handle: ".example",  // 可拖曳的區域
            filter: ".ignore",  // 過濾器,不能拖曳的物件
            preventOnFilter: true, // 當過濾器啟動的時候,觸發event.preventDefault()
            draggable: ".item",  // 可拖曳的物件
            ghostClass: "sortable-ghost",  // 拖曳時,給予物件的類別
            chosenClass: "sortable-chosen",  // 選定時,給予物件的類別
            forceFallback: false  // 忽略HTML5 DnD
        });
    </script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
hsuehmingfangpro
0viewers