Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<style>
:global([draggable]) {
-webkit-touch-callout:none;
-ms-touch-action:none; touch-action:none;
-moz-user-select:none; -webkit-user-select:none; -ms-user-select:none; user-select:none;
}
</style>

<script context="module">
import DragDropTouch from 'svelte-drag-drop-touch'
import ListView from 'svelte-sortable-flat-list-view'
</script>

<script>
let List = []
for (let i = 1; i < 10; i++) { List.push(new String('Item ' + i)) }

function onDroppableHold (x,y, DroppableExtras, DropZoneExtras) {
console.log('onDroppableHold')
console.log(' x,y: ',x,y)
console.log(' DroppableExtras:',DroppableExtras)
console.log(' DropZoneExtras: ',DropZoneExtras)

window.alert('dragged list items were held for more than 2 seconds!')
}
</script>

<p style="line-height:150%">
When sorting this list, try holding the dragged list items on the foreseen
target still for 2 seconds, at least
</p>

<ListView style="width:180px; height:240px; border:solid 1px; overflow:auto"
sortable {List} SelectionLimit={3}
HoldDelay={2000} {onDroppableHold}
/>
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */