Lee.Longmore-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jul-10 04:38 UTC
Dragging out of a scrollable div
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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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, Lee.Longmore-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Lee.Longmore-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jul-10 17:29 UTC
Re: Dragging out of a scrollable div
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 <t...-PGZyUNKar/Q@public.gmane.org> 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, Lee.Longm...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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,
Lee.Longmore-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org 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 <t...-PGZyUNKar/Q@public.gmane.org>
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,
Lee.Longm...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org 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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---