Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Configuring SortableJS Options | Introduction to Drag and Drop and SortableJS
Quizzes & Challenges
Quizzes
Challenges
/
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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you show me an example of how to use these options in code?

What other options are available in SortableJS?

How do I combine the handle and filter options for more control?

bookConfiguring SortableJS Options

Swipe to show menu

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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3
some-alt