echobase
2008-Mar-24 04:45 UTC
how to make a freely draggable element snap into a target element upon release
Hello all- I''m trying to figure out how to make a freely draggable element (one that can be dragged smoothly and freely over any spot on the screen) snap into place once it is hovered and released over a target element. If anybody can help me on this I''d be super grateful. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
echobase
2008-Mar-30 22:05 UTC
Re: how to make a freely draggable element snap into a target element upon release
Anyone? anyone?....... I can''t believe there is no facility for this......... On Mar 23, 9:45 pm, echobase <bushbr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all- > > I''m trying to figure out how to make a freely draggable element (one > that can be dragged smoothly and freely over any spot on the screen) > snap into place once it is hovered and released over a target > element. If anybody can help me on this I''d be super grateful. Thanks.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Gareth Evans
2008-Mar-30 22:10 UTC
Re: how to make a freely draggable element snap into a target element upon release
prototype doesn''t offer this facility. scriptaculous offers most of it. using dragdrop.js (included via scriptaculous.js?load=dragdrop) new Draggable(elementId); Droppables.add(containerid, { onDrop: function() { alert(''Something was dropped on me''); } }); I can''t remember what parameters are passed to onDrop, i think one is the element dropped, another is the droppable -class object-... To ''snap'' like you''re suggesting, you can either do some fancy move stuff or just appendChild the draggable to the droppable, but if you do this, remember to append it back to the original body when it gets moved, or you''ll have z-index style problems due to the draw order. On Mon, Mar 31, 2008 at 11:05 AM, echobase <bushbrian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Anyone? anyone?....... I can''t believe there is no facility for > this......... > > > > > > On Mar 23, 9:45 pm, echobase <bushbr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello all- > > > > I''m trying to figure out how to make a freely draggable element (one > > that can be dragged smoothly and freely over any spot on the screen) > > snap into place once it is hovered and released over a target > > element. If anybody can help me on this I''d be super grateful. Thanks. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---