Skip to content

Commit 4d9b2a8

Browse files
committed
feat(draggable): new config option to move or not the dragged element
1 parent 0f95624 commit 4d9b2a8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/jquery.draggable.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
autoscroll: true,
1717
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'],
1818
handle: null,
19-
container_width: 0 // 0 == auto
19+
container_width: 0, // 0 == auto
20+
move_element: true,
2021
helper: false // or 'clone'
2122
// drag: function(e){},
2223
// start : function(e, ui){},
@@ -283,11 +284,13 @@
283284

284285
this.options.autoscroll && this.manage_scroll(data);
285286

286-
(this.helper ? this.$helper : this.$player).css({
287-
'position': 'absolute',
288-
'left' : offset.left,
289-
'top' : offset.top
290-
});
287+
if (this.options.move_element) {
288+
(this.helper ? this.$helper : this.$player).css({
289+
'position': 'absolute',
290+
'left' : data.position.left,
291+
'top' : data.position.top
292+
});
293+
}
291294

292295
var last_position = this.last_position || data.position;
293296
data.prev_position = last_position;

0 commit comments

Comments
 (0)