Forum: Rails Spinoffs (closed, excessive spam) Draggables.notify .. onEnd

Posted by Toss (Guest)
on 2008-06-13 17:52
(Received via mailing list)
Hi,
I try to used the drag and drop but I have problem to understand.
How use the notify function ?


<div id="drag_demo_1"style="width:130px; height:20px; cursor:move;
border:1px solid #333; "></div>
          <script type="text/javascript">
            new Draggable('drag_demo_1',{snap:[130,59]});
            Draggables.notify('drag_demo_1','1','onEnd');
          </script>

Or maybye someone have a simple example ?

Can you help me ?
Thank you !
Posted by Frederick Polgardy (Guest)
on 2008-06-19 04:17
(Received via mailing list)
You're probably not interested in calling notify() directly.  What you 
want
to do is call addObserver() because scriptaculous calls notify 
internally as
drag events take place:

var drag1 = new Draggable('drag_demo_1', { /* your options go here */ 
});
Draggables.addObserver({
  onEnd: function(eventName, draggable, event) {
    /* do something with the drag event and draggable object here */
    alert(draggable.element); // what element was dragged?
  });

-Fred

On Fri, Jun 13, 2008 at 10:51 AM, Toss 
<christophe.peugnet@sodeasoft.com>
wrote:

>            Draggables.notify('drag_demo_1','1','onEnd');
>          </script>


--
Science answers questions; philosophy questions answers.
Posted by Toss (Guest)
on 2008-06-19 17:50
(Received via mailing list)
Hi Fred ! Many thanks !!!
This topic is locked and can not be replied to.