Hi Cosmin,

For your issue #1, I suggest you to use Prototype's
Element#addClassName and Element#removeClassName, rather than directly
element.className property:

new Draggable(id, {revert: true, ghosting: true,
  onStart: function(draggable) {
    draggable.element.addClassName("someAdditionalClass");
  },
  onEnd: function (draggable) {
    draggable.element.removeClassName("someAdditionalClass");
  }
});

Then, if this is still not working, try to change the style directly:

new Draggable(id, {revert: true, ghosting: true,
  onStart: function(draggable) {
    draggable.element.setStyle({style1: "value", style2: "value"});
  },
  onEnd: function (draggable) {
    draggable.element.setStyle({style1: "another_value", style2:
"another_value"});
  }
});

Finally, if this still doesn't work, maybe the ghosting option causes
the style to be override, I don't know what to suggest ...



On Sep 7, 6:00 am, Cosmin Marginean <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I am trying to customize a Draggable by changing the draggable item
> class when the drag starts to I can highlight which item is being
> dragged (I am using a combination with ghosting and revert).
> I have two issues here:
> 1. When setting this className on the dragging item, I only get the
> desired effect only on the ghosted item (the one that is actually
> being dragged).
> Please note that I've tried both of the solutions below:
> a)
> new Draggable(id, {revert: true, ghosting: true,
>   onStart: function(draggable) {
>     draggable.element.className += " someAdditionalClass";
>   },
>   onEnd: function (draggable) {
>     draggable.element.className = "initialClass";
>   }
>
> });
>
> AND
>
> b)
> new Draggable(id, {revert: true, ghosting: true,
>   starteffect: function(element) {
>     element.className += " someAdditionalClass";
>   },
>   onEnd: function (draggable) {
>     draggable.element.className = "initialClass";
>   }
>
> });
>
> 2. My second problem is related to the reverting of the dragging item.
> During the drag, the item is "cloned" due to the ghosting feature.
> However, when the drag is finished and the clone moves back to the
> initial position, the original item disappears suddenly and the clone
> move to it's place. I am not sure if this is normal behavior, but I
> want to know if I can avoid this. I also implemented the move effect
> from the end of the drag to have a 0 (zero) duration, but there's
> still a short flickering because of this disappearing + moving.
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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