Skip to content

Draggable: Document ui.position modification in drag event #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions entries/draggable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,32 @@
</argument>
</event>
<event name="drag">
<desc>Triggered while the mouse is moved during the dragging.</desc>
<desc>Triggered while the mouse is moved during the dragging, immediately before the current move happens.</desc>
<argument name="event" type="Event"/>
<argument name="ui" type="Object">
<property name="helper" type="jQuery">
<desc>The jQuery object representing the helper that's being dragged.</desc>
</property>
<property name="position" type="Object">
<desc>Current CSS position of the helper as <code>{ top, left }</code> object.</desc>
<desc>Current CSS position of the helper as <code>{ top, left }</code> object. The values may be changed to modify where the element will be positioned. This is useful for custom containment, snapping, etc.</desc>
</property>
<property name="offset" type="Object">
<desc>Current offset position of the helper as <code>{ top, left }</code> object.</desc>
</property>
</argument>
<example>
<desc>Constrain movement via <code>ui.position</code>:</desc>
<code><![CDATA[
$( ".selector" ).draggable({
drag: function( event, ui ) {

// Keep the left edge of the element
// at least 100 pixels from the container
ui.position.left = Math.min( 100, ui.position.left );
}
});
]]></code>
</example>
</event>
<event name="stop">
<desc>Triggered when dragging stops.</desc>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
],
"dependencies": {
"grunt": "0.4.5",
"grunt-jquery-content": "2.0.0"
"grunt-jquery-content": "2.0.1"
}
}