Capturing the position of a draggable element


#1

I would like to capture the position of a draggable element after it’s
being dragged, but I am running into problem using several options, such
as “change”, “revert” and “onEnd”. My callback handler would only fire
when the page loads, and not when the element is dragged. How can I make
this happen?

draggable

#2

2006/1/13, jeannie lu removed_email_address@domain.invalid:

What that does, is assign the return value of “alert(this)” (probably
false or something) to options.onEnd. A simple way to do what you want
would be:

but a more powerful solution would be to create your own object to
handle the dragging, which would look something like this:

var MyDraggable = Class.create();
MyDraggable.prototype = {

initialize: function (element, options) {
  // script.aculo.us drag and drop
  new Draggable(element, options);
  Draggables.addObserver(this);
},

onEnd: function () {

// your code here

}

}

hth,
Douglas