Hey, everyone. I''m kind of new to scriptaculous, but I can''t find any definitive answer on this, so hopefully someone here can help. Beneath is the basic structure of what I''m building. innerBox is a Draggable (new Draggable("innerBox");), because I want it to be able to move anywhere on the page. <div id="main"> <div id="innerBox"> // inside stuff </div> </div> The problem is that I have a border on main, and when you drag the innerBox outside of main, main doesn''t get redrawn, probably because the div is still inside the main in the HTML itself. Is there any way I can get main to redraw itself when the innerBox is removed (or added back in?) Thanks! - gchucky --~--~---------~--~----~------------~-------~--~----~ 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 can specify onDrag callback (to calculate and update outer box dimensions) which will be executed on every mousemove as you drag an element ... http://wiki.script.aculo.us/scriptaculous/show/Draggables Here''s a documentation on which options you can use when initializing draggable object... Hope this helps -- View this message in context: http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.html#a11360225 Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
er... okay. i guess i wasn''t specific enough in my question. basically, i want the outer div to automatically resize as if the inner div wasn''t part of it. and how do you use change? do you write onDrag:change() in the draggable''s options? - gchucky On Jun 29, 9:30 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you can specify onDrag callback (to calculate and update outer box > dimensions) which will be executed on every mousemove as you drag an element > ...http://wiki.script.aculo.us/scriptaculous/show/DraggablesHere''s a > documentation on which options you can use when initializing draggable > object... > > Hope this helps > -- > View this message in context:http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.ht... > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I second the idea of using an eventhandler of the draggable to handle this logic. After briefly reviewing the draggables observer class it looks to have 3 events, the one i''d use for your purposes is onStart. Once you receive the event object, find the element being the inner div and append it to the document.body so its no longer contained within your containing div and the browser should resize the element. On Jun 29, 11:05 am, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> er... okay. i guess i wasn''t specific enough in my question. > basically, i want the outer div to automatically resize as if the > inner div wasn''t part of it. > > and how do you use change? do you write onDrag:change() in the > draggable''s options? > > - gchucky > > On Jun 29, 9:30 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > you can specify onDrag callback (to calculate and update outer box > > dimensions) which will be executed on every mousemove as you drag an element > > ...http://wiki.script.aculo.us/scriptaculous/show/DraggablesHere''s a > > documentation on which options you can use when initializing draggable > > object... > > > Hope this helps > > -- > > View this message in context:http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.ht... > > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
By using onStart, do you mean that when the drag begins, it should start figuring out whether or not it''s over the div or not? Hm, okay. I did a modified version of that, but I used onEnd. I figure out if I''m over the div or not, and if I am, then I append to the div; otherwise I append to the body. The biggest problem now is that its movement is incredibly erratic, and moves while almost disregarding the mouse. Any tips on that? On Jun 29, 3:47 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I second the idea of using an eventhandler of the draggable to handle > this logic. > > After briefly reviewing the draggables observer class it looks to have > 3 events, the one i''d use for your purposes is onStart. Once you > receive the event object, find the element being the inner div and > append it to the document.body so its no longer contained within your > containing div and the browser should resize the element. > > On Jun 29, 11:05 am, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > er... okay. i guess i wasn''t specific enough in my question. > > basically, i want the outer div to automatically resize as if the > > inner div wasn''t part of it. > > > and how do you use change? do you write onDrag:change() in the > > draggable''s options? > > > - gchucky > > > On Jun 29, 9:30 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > you can specify onDrag callback (to calculate and update outer box > > > dimensions) which will be executed on every mousemove as you drag an element > > > ...http://wiki.script.aculo.us/scriptaculous/show/DraggablesHere''sa > > > documentation on which options you can use when initializing draggable > > > object... > > > > Hope this helps > > > -- > > > View this message in context:http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.ht... > > > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve mostly accomplished my goal. I''m using a droppable, and when onDrop fires, the inner div gets added to the outer one. Now I just need to figure out the reverse. Is there any way to check to see if I''m hovering over the droppable or not? On Jun 29, 4:41 pm, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> By using onStart, do you mean that when the drag begins, it should > start figuring out whether or not it''s over the div or not? > > Hm, okay. I did a modified version of that, but I used onEnd. I figure > out if I''m over the div or not, and if I am, then I append to the div; > otherwise I append to the body. The biggest problem now is that its > movement is incredibly erratic, and moves while almost disregarding > the mouse. Any tips on that? > > On Jun 29, 3:47 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I second the idea of using an eventhandler of the draggable to handle > > this logic. > > > After briefly reviewing the draggables observer class it looks to have > > 3 events, the one i''d use for your purposes is onStart. Once you > > receive the event object, find the element being the inner div and > > append it to the document.body so its no longer contained within your > > containing div and the browser should resize the element. > > > On Jun 29, 11:05 am, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > er... okay. i guess i wasn''t specific enough in my question. > > > basically, i want the outer div to automatically resize as if the > > > inner div wasn''t part of it. > > > > and how do you use change? do you write onDrag:change() in the > > > draggable''s options? > > > > - gchucky > > > > On Jun 29, 9:30 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > you can specify onDrag callback (to calculate and update outer box > > > > dimensions) which will be executed on every mousemove as you drag an element > > > > ...http://wiki.script.aculo.us/scriptaculous/show/DraggablesHere''sa > > > > documentation on which options you can use when initializing draggable > > > > object... > > > > > Hope this helps > > > > -- > > > > View this message in context:http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.ht... > > > > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Heh, sorry for yet another post. This''ll be my last, as I got it to do what I want. Here''s the code, in case anyone has this problem. For the draggable: change:function(elt) { // default styling document.body.appendChild($("innerDiv")); if($("outerDiv").hasChildNodes()) { $("outerDiv").removeChild(theTsb); } } For the droppable: onDrop:function(a,b,c) { $("outerDiv").appendChild($("innerDiv")); Position.relativize($("innerDiv")); //style the innerDiv } Thanks to everyone who gave me advice! On Jun 29, 9:47 pm, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve mostly accomplished my goal. I''m using a droppable, and when > onDrop fires, the inner div gets added to the outer one. Now I just > need to figure out the reverse. > > Is there any way to check to see if I''m hovering over the droppable or > not? > > On Jun 29, 4:41 pm, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > By using onStart, do you mean that when the drag begins, it should > > start figuring out whether or not it''s over the div or not? > > > Hm, okay. I did a modified version of that, but I used onEnd. I figure > > out if I''m over the div or not, and if I am, then I append to the div; > > otherwise I append to the body. The biggest problem now is that its > > movement is incredibly erratic, and moves while almost disregarding > > the mouse. Any tips on that? > > > On Jun 29, 3:47 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I second the idea of using an eventhandler of the draggable to handle > > > this logic. > > > > After briefly reviewing the draggables observer class it looks to have > > > 3 events, the one i''d use for your purposes is onStart. Once you > > > receive the event object, find the element being the inner div and > > > append it to the document.body so its no longer contained within your > > > containing div and the browser should resize the element. > > > > On Jun 29, 11:05 am, gchucky <gchu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > er... okay. i guess i wasn''t specific enough in my question. > > > > basically, i want the outer div to automatically resize as if the > > > > inner div wasn''t part of it. > > > > > and how do you use change? do you write onDrag:change() in the > > > > draggable''s options? > > > > > - gchucky > > > > > On Jun 29, 9:30 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > you can specify onDrag callback (to calculate and update outer box > > > > > dimensions) which will be executed on every mousemove as you drag an element > > > > > ...http://wiki.script.aculo.us/scriptaculous/show/DraggablesHere''sa > > > > > documentation on which options you can use when initializing draggable > > > > > object... > > > > > > Hope this helps > > > > > -- > > > > > View this message in context:http://www.nabble.com/Draggable-DIV-and-resizing-parent--tf3998169.ht... > > > > > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---