Take the following, for example:
...
<div id="main">
<div id="listOfDraggables" style="overflow:auto"><div
id="drag_1">.... <div id="drag_n">...
</div><!-- end listOfDraggables -->
</div> <!-- end main -->
Let's say you want to drag "drag_1". Because of the CSS that's been
defined ("overflow:auto"), "drag_1" can't be moved outside (visually)
of "listOfDraggables", so long as it is a child of "listOfDraggables".
One solution is, when you start your drag of "drag_1", move it to a
different parent. In other words, make it a child of (for example)
"main", so it is now a sibling of "listOfDraggables" rather than a
child.
If you're doing a one-way drop, what I'd suggest is to create the
Draggable "just in time", i.e. after the mousedown. This allows you
to clone the original element, give it a different DOM parent node,
and then create a single draggable. This requires a bit of extra code
to kick-start the draggable (as its drag has already started).
onMouseDown: function (event) {
var d = new Draggable(someDiv);
//You'll need to add these two lines to start a draggable if
mouse is already down
d.initDrag(event);
Draggables.updateDrag(event);
}
I hope that helps.
TAG
On Jul 10, 2007, at 11:29 AM, [EMAIL PROTECTED] wrote:
>
> Thanks, Tom. To clarify - what do you mean by moving the element to a
> different parent? The element to be dragged?
>
> My goal is to have a potentially long list of elements -- hence the
> scrollbar -- which can be dragged across to the "main" div.
>
> On 10 Jul, 16:32, Tom Gregory <[EMAIL PROTECTED]> wrote:
>> You just defined one way to resolve the problem--you just don't like
>> the answer. Don't have the parent be overflow:auto (or scroll).
>>
>> The CSS is doing exactly what the spec says it should do when
>> overflow is defined that way: child elements can't extend past the
>> border of the parent. Your only other option is to move the element
>> to a different parent, perhaps one higher up in the DOM tree.
>>
>> TAG
>>
>> On Jul 9, 2007, at 10:38 PM, [EMAIL PROTECTED] wrote:
>>
>>
>>
>>> Hello,
>>
>>> I am trying to drag a div element (Z) out of a containing div (A) to
>>> an adjacent div (B).
>>
>>> With overflow: auto set for A, it is not possible to drag out Z
>>> out of
>>> A. It's fine when I remove overflow: auto but I really do need a
>>> scrollable region for A.
>>
>>> I have read the past posts on this topic but I am unclear how to
>>> best
>>> resolve the problem.
>>
>>> Is it still a problem or has this been addressed in later
>>> releases? I
>>> have tried to find reference to it in the script.aculo.us and Rails
>>> enhancements/documentation sites but without success.
>>
>>> Can anyone recommend a good solution to the problem?
>>
>>> Thank you.
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---