1.  
  2. var handleTween;
  3. handleTween = ddThingToDrag.onDrag = function(e) {
  4. topMarker.style.display = "block";
  5. leftMarker.style.display = "block";
  6.  
  7. var left = parseInt(thingToDrag.style.left) + "px";
  8. var top = parseInt(thingToDrag.style.top) + "px";
  9. thingToDrag.innerHTML = left + ", " + top;
  10. topMarker.style.top = topMarker.innerHTML = top;
  11. leftMarker.style.left = leftMarker.innerHTML = left;
  12. }
  13. ...
  14. var handleComplete;
  15. handleComplete = ddThingToDrag.endDrag = function(e) {
  16. if (this.getDragEl) {
  17. var dragEl = this.getDragEl();
  18. from.push({left: YAHOO.util.Dom.getX(dragEl), top: YAHOO.util.Dom.getY(dragEl)});
  19. }
  20. topMarker.style.display = "none";
  21. leftMarker.style.display = "none";
  22. if (to.length > 0) {
  23. undoBtn.style.display = "block";
  24. } else {
  25. undoBtn.style.display = "none";
  26. }
  27. if (this instanceof YAHOO.util.Motion) {
  28. this.onComplete.unsubscribe(handleComplete);
  29. this.onTween.unsubscribe(handleTween);
  30. }
  31. }
  32.  
  33.