Drag Objects

I.dragTo

Drags an element to another target element

Usage

I.dragTo(element, target);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

targetstring

Keyword to identify the target element to drop on.
This is case-insensitive.
CSS / XPATHs may also be used.

Example(s)

Drag elements using labels

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragTo("drag me", "drop here")

Drags the element "drag me" to the target element "drop here".

Drag elements using CSS

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragTo("#draggable", "#droppable")

Drags the element with the ID "draggable" to the target element with the ID "droppable".


I.dragBy

Drags an element directionally by (x,y) pixels right and down.

Usage

I.dragBy(element, x, y);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

xnumberNumber of pixels to drag right. Use negative numbers to drag left instead.
ynumberNumber of pixels to drag down. Use negative numbers to drag up instead.

Example(s)

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragBy("drag me", 150, 75)

Drags the element "drag me" 150 pixels right, and 75 pixels down.


I.dragUp

Drags an element up by a given number of pixels

Usage

I.dragUp(element, y);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

ynumberNumber of pixels to drag up.

Example(s)

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragUp("drag me", 10)

Drags the element "drag me" 10 pixels up.


I.dragDown

Drags an element down by a given number of pixels

Usage

I.dragDown(element, y);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

ynumberNumber of pixels to drag down.

Example(s)

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragDown("drag me", 10)

Drags the element "drag me" 10 pixels down.


I.dragLeft

Drags an element left by a given number of pixels

Usage

I.dragLeft(element, x);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

xnumberNumber of pixels to drag left.

Example(s)

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragLeft("drag me", 10)

Drags the element "drag me" 10 pixels left.


I.dragRight

Drags an element right by a given number of pixels

Usage

I.dragRight(element, x);

Parameters

ParameterTypeRemarks
elementstring

Keyword to identify the element to drag.
This is case-insensitive.
CSS / XPATHs may also be used.

xnumberNumber of pixels to drag right.

Example(s)

I.goTo("http://jqueryui.com/resources/demos/droppable/default.html")
I.dragRight("drag me", 10)

Drags the element "drag me" 10 pixels right.

Last Updated: