Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Configuring SortableJS Options | Introduction to Drag and Drop and SortableJS
SortableJS Drag and Drop Interfaces with JavaScript

bookConfiguring SortableJS Options

When working with SortableJS to create interactive lists, you can fine-tune the user experience by configuring several important options. Three commonly used options are animation, handle, and filter. The animation option controls the smoothness and speed of the movement when a list item is dragged and dropped. By setting a value in milliseconds, you can make the transition between positions look more fluid, which can help users understand where items are moving.

The handle option lets you specify a particular part of each list item that acts as the area for starting a drag action. This is especially useful when you want to prevent accidental sorting—users must click and drag only on the designated handle, not anywhere on the item. You define the handle by assigning a CSS selector that matches an element inside each sortable item.

The filter option allows you to exclude certain elements from being draggable or sortable. For instance, if your list items contain buttons or links, you might want to prevent users from dragging these parts. By providing a selector to the filter option, you can ensure that elements matching this selector will not trigger sorting, making your list safer and more intuitive to use.

These options give you precise control over how users interact with your sortable lists, making your drag-and-drop interfaces both functional and user-friendly.

index.html

index.html

style.css

style.css

copy
question mark

According to the overview of SortableJS options, what does the 'handle' option allow you to do?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 3

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

bookConfiguring SortableJS Options

Pyyhkäise näyttääksesi valikon

When working with SortableJS to create interactive lists, you can fine-tune the user experience by configuring several important options. Three commonly used options are animation, handle, and filter. The animation option controls the smoothness and speed of the movement when a list item is dragged and dropped. By setting a value in milliseconds, you can make the transition between positions look more fluid, which can help users understand where items are moving.

The handle option lets you specify a particular part of each list item that acts as the area for starting a drag action. This is especially useful when you want to prevent accidental sorting—users must click and drag only on the designated handle, not anywhere on the item. You define the handle by assigning a CSS selector that matches an element inside each sortable item.

The filter option allows you to exclude certain elements from being draggable or sortable. For instance, if your list items contain buttons or links, you might want to prevent users from dragging these parts. By providing a selector to the filter option, you can ensure that elements matching this selector will not trigger sorting, making your list safer and more intuitive to use.

These options give you precise control over how users interact with your sortable lists, making your drag-and-drop interfaces both functional and user-friendly.

index.html

index.html

style.css

style.css

copy
question mark

According to the overview of SortableJS options, what does the 'handle' option allow you to do?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 3
some-alt