.drag()

  • function
FuncUnit.prototype.drag  

Options as Coordinates

drag(options [,success])

Drags an element into another element or coordinates. This takes the same paramameters as [syn.prototype.move move].

Parameters

  1. options {String | Object}

    A selector or coordinates describing the motion of the drag.

    Options as a Selector
    Passing a string selector to drag the mouse. The drag runs to the center of the element matched by the selector. The following drags from the center of #foo to the center of #bar. ```js F('#foo').drag('#bar') ```
  2. success {function()}Optional

    a callback that runs after the drag, but before the next action.

Returns

{funcUnit}

returns the funcunit object for chaining.

You can pass in coordinates as clientX and clientY:

F('#foo').drag('100x200')
``` Or as pageX and pageY

```js
F('#foo').drag('100X200')
``` Or relative to the start position
F('#foo').drag('+10 +20')
 <h5>Options as an Object</h5>
 You can configure the duration, start, and end point of a drag by passing in a json object.

```js
//drags from 0x0 to 100x100 in 2 seconds
F('#foo').drag({
  from: "0x0",
  to: "100x100",
  duration: 2000
})