- Source:
Methods
(static) disableDragging(element)
Disable previously configured dragging support on an HTML element.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
jQuery | the dragged element |
- Source:
(static) disableLongPress(element)
Disable previously configured long press support on an HTML element.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
jQuery | the element on which presses are detected |
- Source:
(static) enableDragging(element, onMove, onBegin, onEnd, directionopt, nullable)
Setup an HTML element for dragging.
All coordinates passed to the callbacks are CSS pixels, so they can be compared or combined with em units and CSS
lengths directly. Use qui.utils.css.unscalePx on any offset() or position() value measured against them.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
jQuery | the dragged element |
|
onMove |
qui.utils.gestures.DragMoveCallback | ||
onBegin |
qui.utils.gestures.DragBeginCallback | ||
onEnd |
qui.utils.gestures.DragEndCallback | ||
direction |
String |
<optional> <nullable> |
indicates dragging direction: |
- Source:
(static) enableLongPress(element, onLongPress, onShortPressopt, nullable, selectoropt, nullable, durationopt, moveThresholdopt)
Setup long press detection on an HTML element.
Detection is based on pointer events, which never block scrolling; a press is automatically abandoned as soon as
the browser starts scrolling with the same pointer, or as soon as the pointer moves further than moveThreshold.
When a selector is given, presses are detected for matching descendants of element rather than for element
itself. This allows handling long presses on a large number of children with a single set of event handlers.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
jQuery | the element on which presses are detected |
|
onLongPress |
qui.utils.gestures.LongPressCallback | called when the element has been pressed for at least
|
|
onShortPress |
qui.utils.gestures.LongPressCallback |
<optional> <nullable> |
called when the element has been released before
|
selector |
String |
<optional> <nullable> |
an optional selector restricting detection to matching descendants of |
duration |
Number |
<optional> |
how long the element must be pressed for a long press, in milliseconds (defaults to
|
moveThreshold |
Number |
<optional> |
how far the pointer may move before the press is abandoned, in pixels (defaults to
|
- Source:
Type Definitions
DragBeginCallback(elemX, elemY, pageX, pageY) → {Boolean}
Drag Begin Callback Function.
Parameters:
| Name | Type | Description |
|---|---|---|
elemX |
Number | the initial element x coordinate, relative to page |
elemY |
Number | the initial element y coordinate, relative to page |
pageX |
Number | the x coordinate, relative to page |
pageY |
Number | the y coordinate, relative to page |
- Source:
Returns:
false to prevent dragging
- Type
- Boolean
DragEndCallback(elemX, elemY, deltaX, deltaY, pageX, pageY)
Drag End Callback Function.
Parameters:
| Name | Type | Description |
|---|---|---|
elemX |
Number | the final element x coordinate, relative to page |
elemY |
Number | the final element y coordinate, relative to page |
deltaX |
Number | the final x coordinate variation, relative to initial drag point |
deltaY |
Number | the final y coordinate variation, relative to initial drag point |
pageX |
Number | the x coordinate inside, relative to page |
pageY |
Number | the y coordinate inside, relative to page |
- Source:
DragMoveCallback(elemX, elemY, deltaX, deltaY, pageX, pageY)
Drag Move Callback Function.
Parameters:
| Name | Type | Description |
|---|---|---|
elemX |
Number | the new element x coordinate, relative to page |
elemY |
Number | the new element y coordinate, relative to page |
deltaX |
Number | the x coordinate variation, relative to initial drag point |
deltaY |
Number | the y coordinate variation, relative to initial drag point |
pageX |
Number | the x coordinate, relative to page |
pageY |
Number | the y coordinate, relative to page |
- Source:
LongPressCallback(element, event)
Long Press Callback Function.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
jQuery | the pressed element |
event |
jQuery.Event | the pointer event that started the press |
- Source: