Syn.move  function     

Moves the cursor from one point to another.

Quick Example

The following moves the cursor from (0,0) in the window to (100,100) in 1 second.

Syn.move(
     {
       from: {clientX: 0, clientY: 0},
       to: {clientX: 100, clientY: 100},
       duration: 1000
     },
     document.document)

Options

There are many ways to configure the endpoints of the move.

PageX and PageY

If you pass pageX or pageY, these will get converted to client coordinates.

Syn.move(
     {
       from: {pageX: 0, pageY: 0},
       to: {pageX: 100, pageY: 100}
     },
     document.document)

String Coordinates

You can set the pageX and pageY as strings like:

Syn.move(
     {
       from: "0x0",
       to: "100x100"
     },
     document.document)

Element Coordinates

If jQuery is present, you can pass an element as the from or to option and the coordinate will be set as the center of the element. Syn.move( { from: $(".recipe")[0], to: $("#trash")[0] }, document.document)

Query Strings

If jQuery is present, you can pass a query string as the from or to option.

Syn.move( { from: ".recipe", to: "#trash" }, document.document)

No From

If you don't provide a from, the element argument passed to Syn is used.

Syn.move(
     { to: "#trash" },
     'myrecipe')

Relative

You can move the drag relative to the center of the from element.

Syn.move("+20 +30", "myrecipe");
Syn.move(options, from, callback) -> undefined
{Object}

options to configure the drag

{HTMLElement}

the element to move

{Function}

a callback that happens after the drag motion has completed

{undefined}
© Jupiter IT - JavaScriptMVC Training and Support