jQuery UI Helpers / Draggable

Simple Draggable

You can create a draggable widget with the BeginDraggable method.

You should call the BeginDraggable method in a using statement. This is required to emit all the necessary HTML tags into the response.

The following example creates a simple draggable.

@using (Html.JQueryUI().BeginDraggable())
{
    <span>Drag me around.</span>
}

This creates a simple draggable element.

Drag me around.

Configuration

Like the other widgets the draggable also has a fluent configuration API. To use it, create the draggable with the Begin method which takes a Draggable as its argument. The following example demonstrates this.

@using (Html.JQueryUI().Begin(new Draggable().Cursor(Cursor.Move)))
{
    <span>Drag me around.</span>
}

This creates the draggable below.

Drag me around.

HTML Helpers

Fluent Configuration API