Search and Top Navigation
#5718 closed bug (duplicate)
Opened June 10, 2010 03:42PM UTC
Closed March 17, 2013 02:34PM UTC
Draggable: distance between element and cursor increases when vertically scrolling during drag
Reported by: | cattz | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 2.0.0 |
Component: | ui.draggable | Version: | 1.8.2 |
Keywords: | ui.draggable scroll | Cc: | |
Blocked by: | Blocking: |
Description
Hi,
This problem is appeared since the v1.8 (no problem in 1.7 versions). When I move my draggable element outside the visible page (when the page scroll -> scroll:'true'), the draggable element doesnt appear beside my cursor but x pixels on top or bottom of my cursor. This phenomenon only occurs during a vertical autoscroll, not with horizontal autoscroll.
My code :
$(id_class_html).draggable( {handle : '.drg', revert:true, scroll:true, scrollSensitivity : 10, zIndex : 100, containment : 'document', revertDuration : 0, scrollSpeed : 45, opacity: 0.80, cursor: 'move', drag : function(event, ui) {...} });
Thanks
Cattz
Attachments (0)
Change History (11)
Changed April 17, 2012 08:20AM UTC by comment:1
_comment0: | Same problem here. \ The position of the element being dragged seems to be incremented as you scroll. \ \ However, I've found that if the element has position:absolute this does not occur. \ You can try it here: http://jsfiddle.net/hMdZj/ \ Try to drag the box down to not visible areas. If you remove the position:absolute the bug appears. → 1334650976517373 |
---|
Changed October 11, 2012 09:07PM UTC by comment:2
milestone: | TBD → 2.0.0 |
---|
Changed October 26, 2012 04:35AM UTC by comment:3
_comment0: | confirmed: http://jsfiddle.net/9xrf4/ → 1351226169671492 |
---|---|
status: | new → open |
confirmed on latest: http://jsfiddle.net/9xrf4/
simply drag the draggable to the edge of the window, and as the page scrolls to accomodate, notice it moves away from the cursor
Changed October 27, 2012 07:59PM UTC by comment:5
summary: | Problem with autoscroll when dragging an element (vertical drag) → Draggable: distance between element and cursor increases when vertically scrolling during drag |
---|
Changed January 25, 2013 06:49PM UTC by comment:9
I've hacked a solution but I'm not sure of the root cause nor why the solution (which is trivial) wouldn't always be the right thing to do:
in draggable.js: _mouseDrag (L 205), compute this.helper[0].style.top = (event.pageY - this.originalPageY) +"px"
My observation is that pageY was changing much less rapidly than scrollTop() although they should have changed at exactly the same rate afaik. I actually believe pageY was wrong, but it's where the mouse is and subsequent events are reported by the mouse's posit; so, it's where the helper should be. Given this, I'm not sure there's a reason to call _generatePosition nor _convertPositionTo and that the helper's top and left could be simple computations of (original)page(X|Y).
if this fix seems sound, I'm happy to do the official process.
Changed January 27, 2013 02:48AM UTC by comment:10
Replying to [comment:9 dhmitchell]:
I've hacked a solution but I'm not sure of the root cause nor why the solution (which is trivial) wouldn't always be the right thing to do: in draggable.js: _mouseDrag (L 205), compute this.helper[0].style.top = (event.pageY - this.originalPageY) +"px"
My observation is that pageY was changing much less rapidly than scrollTop() although they should have changed at exactly the same rate afaik. I actually believe pageY was wrong, but it's where the mouse is and subsequent events are reported by the mouse's posit; so, it's where the helper should be. Given this, I'm not sure there's a reason to call _generatePosition nor _convertPositionTo and that the helper's top and left could be simple computations of (original)page(X|Y). if this fix seems sound, I'm happy to do the official process.
I believe that the code there is specifically for dealing with helpers (http://api.jqueryui.com/draggable/#option-helper). In general though if you can come up with a fix feel free to send a pull request. Keep in mind that we'll want tests along with the fix.
Thanks.
Changed March 17, 2013 02:34PM UTC by comment:11
resolution: | → duplicate |
---|---|
status: | open → closed |
Duplicate of #6817.
Same problem here.
The position of the element being dragged seems to be incremented as you scroll.
However, I've found that if the element has position:absolute this does not occur.
You can try it here: http://jsfiddle.net/hMdZj/
Try to drag the box down to no-visible areas. If you remove the position:absolute the bug appears.