Chapter 12. jQuery UI Interactions and Effects
jQuery UI has more to offer than just user interface widgets. It also provides a handful of useful features for adding interactivity to your web pages and web applications. These jQuery UI interactions provide the tools to let visitors move elements on a page. For example, some widgets are draggable and droppable, which means visitors can drag an element and drop it onto another element—think dragging a file to the trash, or dragging a product to a shopping cart. You can also make lists of sortable items that the user can rearrange by simply dragging an item to a new position in the list—think to-do lists or music playlists.
In addition, jQuery UI includes a suite of effects that you can use to add visual flair to your site with high-quality animations. For example, you can grab a visitor’s attention by making an element’s background color flash, make a page element bounce, shake, scale, or explode. You’ll learn about effects on jQuery UI Effects.
The Draggable Widget
Dragging is second nature when you’re on a computer—dragging files into folders or the trash, dragging windows to make room for more windows, and so on. These interactions are natural for a generation who has grown up with personal computers and mice. jQuery UI brings this same type of interaction to web pages with its draggable widget and its companion, the droppable widget (discussed on The Droppable Widget).
The Draggable widget lets you make any page element movable. You’ve ...