Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Resolves an issue with drop targets being incorrectly offset in a scrolled scroll container #33

wants to merge 1 commit into from

1 participant


Fixes issue #32. When dragging draggables within a scroll container, the droppable does not register the scrollLeft or scrollTop of the scrolling container, resulting in a drop offset that is incorrect. This is particularly noticeable in Sortables when trying to drag down or to the right beyond the scroll limits.

There's still some weird stuff going on when dragging beyond the boundaries of the scroll container, the mouse position relative to the draggable gets altered so that the draggable is no longer below the cursor, but at least the item actually drops into the right place now. Hopefully someone more competent than I can figure out that bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 3, 2012
  1. @ChiperSoft
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/dragdrop.js
10 src/dragdrop.js
@@ -355,9 +355,13 @@ var Draggable = Class.create({
updateDrag: function(event, pointer) {
if(!this.dragging) this.startDrag(event);
+ var dropPoint = (this.options.scroll && this.options.scroll != window) ?
+ [pointer[0] + this.options.scroll.scrollLeft, pointer[1] + this.options.scroll.scrollTop] :
+ pointer;
-, this.element);
+, this.element);
Draggables.notify('onDrag', this, event);
@@ -373,8 +377,8 @@ var Draggable = Class.create({
with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
} else {
p =;
- p[0] += this.options.scroll.scrollLeft + Position.deltaX;
- p[1] += this.options.scroll.scrollTop + Position.deltaY;
+ p[0] += Position.deltaX;
+ p[1] += Position.deltaY;
Something went wrong with that request. Please try again.