Great, thanks. I will give that a try :-)

On Sep 6, 11:58 pm, elduderino <[EMAIL PROTECTED]> wrote:
> Well you can use var pos = .cumulativeOffset(); to find where it was
> dropped:
>
> Droppables.add('droppable'+this.gameCount+ '_' + dropZoneCount, {
>             accept: 'mydraggable',
>             hoverclass: 'dropallowed',
>             onDrop : (function(obj) {
>
> var pos = Position.cumulativeOffset(obj);
>     params['left'] = pos[0];
>     params['top'] = pos[1];
>
> //...
>
> On Sep 6, 7:24 am, novastorm <[EMAIL PROTECTED]> wrote:
>
> > I need some more clarification. I have looked at both methods and I
> > don't see how they
> > can make my new element appear in exactly the same coordinates on the
> > screen as
> > the draggable is when I drop it.
>
> > Just to make things clearer: When I hover over my droppable div, and
> > say I am 145px from
> > the top and 157px from the left of the droppable div, that's where I
> > want the new element to appear.
> > And just to complicate things further, the draggable element is not
> > the same kind of element that I
> > make when I drop it (so cloneNode doesn't seem to cut it). I drag a
> > div element (or could be an
> > image as well) with a description of the element it will make, and
> > when it drops, it actually gets
> > created.
>
> > On Sep 5, 7:18 pm, Matt Foster <[EMAIL PROTECTED]> wrote:
>
> > > Use the cloneNode method on the element and then use insertBefore and
> > > the original element reference as the second parameter so that it will
> > > appear just in front of the original, when the original is removed the
> > > cloned element will be in the right spot.
>
> > > On Sep 5, 10:24 am, elduderino <[EMAIL PROTECTED]> wrote:
>
> > > > Sorry i meant this needs to be done when setting up your droppables,
> > > > not draggables
>
> > > > On Sep 5, 4:17 pm, elduderino <[EMAIL PROTECTED]> wrote:
>
> > > > > It's not so complicated.....ondrop just do something like this:
>
> > > > > Droppables.add('droppable'+this.gameCount+ '_' + dropZoneCount, {
> > > > >             accept: 'mydraggable',
> > > > >             hoverclass: 'dropallowed',
> > > > >             onDrop : (function(obj) {
> > > > >                      var newCopy = new Element('div', {
> > > > >                     'id' : obj.id,
> > > > >                     'class' : 'myclass'
> > > > >                 }).update(obj.innerHTML);
>
> > > > >                 $(dropZoneRef).appendChild(newCopy);
>
> > > > > So this needs to be done when you're setting up your draggables. Just
> > > > > make a new copry and you have access to your original element from the
> > > > > obj variable in the code above.
> > > > > Then you just need a reference to your dropzone (dropZoneRef) and
> > > > > append the new copy.
>
> > > > > Hope this helps
>
> > > > > On Sep 5, 7:49 am, novastorm <[EMAIL PROTECTED]> wrote:
>
> > > > > > I have a draggable, that I drop into a dropzone. onDrop I want to 
> > > > > > make
> > > > > > a new element,
> > > > > > then make it appear in the same spot where the draggable was dropped
> > > > > > (the draggable
> > > > > > reverts after, so that the process may be repeated). I have been
> > > > > > trying to do this with
> > > > > > clonePosition, but so far I can't make it work because the offset is
> > > > > > totally wrong, so
> > > > > > that the clone appears far below where it is intended to or it 
> > > > > > doesn't
> > > > > > position itself at all.
>
> > > > > > Here is a summary of the code, which is part of my function
> > > > > > makeNewElement, that
> > > > > > is called onDrop:
>
> > > > > > // My new element
> > > > > > var newElement = new Element(eType, eOptions);
>
> > > > > > // A div that contains my new element, that is to be placed in a
> > > > > > certain position
> > > > > > var container = new Element('div', {
> > > > > >                                         'id' : "item" + i,
> > > > > >                                         'class' : 'dropped',
> > > > > >                                         });
>
> > > > > > container.insert("<span id=\"label" + i + "\"class=\"item_label
> > > > > > \">Description</span>");
> > > > > > container.insert(newElement);
> > > > > > dropzone.insert(container);
>
> > > > > > // I thought clonePosition worked like this:
> > > > > > // element.clonePosition(clone_onto_this_element, source_to_clone
> > > > > > { options });
> > > > > > // I want to clone my draggable position onDrop onto container, so
> > > > > > I've been trying this:
>
> > > > > > container.clonePosition( container, dragEl,
> > > > > >         {
> > > > > >           'setLeft'             : false,
> > > > > >           'setTop'              : false,
> > > > > >           'setWidth'    : false,
> > > > > >           'setHeigt'            : false,
> > > > > >           'offsetLeft'  : 0,
> > > > > >           'offsetTop'   : 0
> > > > > >          }
> > > > > > );
>
> > > > > > Obiously (?), this does not work. The element is created, but 
> > > > > > without
> > > > > > the desired position.
> > > > > > I have set my new elements css class to "position: absolute" btw 
> > > > > > (and
> > > > > > tried absolutize as well).
>
> > > > > > Any suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to