Hi all, I was wondering if anyone could help with an issue I'm seeing
when trying to use Draggables with scriptaculous 1.8.1.

My code is of the following form, where I loop through an array of DOM
elements and create a Draggable providing the element's id:

for (var i = 0; i < els.length; i++) {
   new Draggable(els[i].id);

But when I drag els[0], els[els.length-1] moves instead!

Now the Draggable code I'm using contains the following lines from the
Draggable initialisation:

    this.element = $(element);

    if(options.handle && Object.isString(options.handle))
      this.handle = this.element.down('.'+options.handle, 0);

    if(!this.handle) this.handle = $(options.handle);
    if(!this.handle) this.handle = this.element;

When this code is executed the first time, "this.element" is undefined
and "this.handle" is undefined, which I would expect. The
initialisation completes with "this.element" set to the DOM element
matching els[0].id, and "this.handle" also set to this DOM element (as
I don't provide an explicit handle CSS class).

But the 2nd time this is executed, "this.element" and "this.value"
have the values from the previous execution!

Now this isn't a problem for "this.element", as this value is always
overwritten. "this.handle" is NOT always overriden though. Again, I
don't provide a handle CSS class, so the first IF is not successful.
Nor are the 2nd and 3rd IFs, because "this.handle" is already set!
(incorrectly in my opinion).

Has anyone seen this before, or could point out any glaring errors I
have made?


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-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to