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 <[EMAIL PROTECTED]> wrote:

> Anyone? anyone?....... I can't believe there is no facility for
> this.........
> On Mar 23, 9:45 pm, echobase <[EMAIL PROTECTED]> 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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to