Forum: Rails Spinoffs (closed, excessive spam) Creating draggable in a scrollable div, element won't scroll

Posted by Nathan Peel (emullet)
on 2007-11-13 16:22
So I am using Scriptaculous to create a draggable on the fly with the on
mousedown event. In IE7 (and perhaps IE6, haven't tested it there yet)
after I kick start the dragging the draggable functions fine. The issue
is that after the dragging action is completed if you scroll the div the
element stays positioned in the div where it was when you initiated the
original dragging operation.

Is this an issue with the CSS of the scrollable div? Is this possibly an
issue with the somewhat dated versions of prototype/scriptaculous I'm
using? Does the scroll:window option have any effect on divs that
contain the original element or is that just for dragging INTO a
scrollable element?

I will greatly appreciate any help on this.
Thanks!
Posted by Nathan Peel (emullet)
on 2007-11-14 01:38
Looking at the elements after they have been touched by scriptaculous 
and made draggable it appears that scriptaculous adds inline style to 
the elements.

I have attempted to use the element.replace function and this fixes the 
issue, but I can't get it to fire after scriptaculous is done doing its 
dragging business. If I try to the replace the element in any of the 
draggable obvserved event handlers IE freaks out with errors (I'm 
guessing that is because it is destroying the element inside of a 
function that is attached to the element).

Nathan Peel wrote:
> So I am using Scriptaculous to create a draggable on the fly with the on
> mousedown event. In IE7 (and perhaps IE6, haven't tested it there yet)
> after I kick start the dragging the draggable functions fine. The issue
> is that after the dragging action is completed if you scroll the div the
> element stays positioned in the div where it was when you initiated the
> original dragging operation.
> 
> Is this an issue with the CSS of the scrollable div? Is this possibly an
> issue with the somewhat dated versions of prototype/scriptaculous I'm
> using? Does the scroll:window option have any effect on divs that
> contain the original element or is that just for dragging INTO a
> scrollable element?
> 
> I will greatly appreciate any help on this.
> Thanks!
Posted by Nathan Peel (emullet)
on 2007-11-20 22:32
Scriptaculous applies the inline style position:relative; to the element 
when its drag is ended.

The fix ended up being typically lame for an IE fix, I set the position 
of the scrolling div to relative inline and it works like a charm now!
Posted by Tom Kim (debugger2020)
on 2008-06-17 02:01
Nathan Peel wrote:
> Scriptaculous applies the inline style position:relative; to the element 
> when its drag is ended.
> 
> The fix ended up being typically lame for an IE fix, I set the position 
> of the scrolling div to relative inline and it works like a charm now!

It worked for me to. Your excellent!!!
This topic is locked and can not be replied to.