The short version: // 1. Create the copy. For this example in a variable called 'div', set your options // 2. Inside your mousedown handler, create your Draggable var d = new Draggable(div, {revert: false, ghosting: false }); // 3. Pass the current event to Draggable.init() and Draggable.updateDrag() d.initDrag(event); Draggables.updateDrag(event); The long version: (I've removed some application specific code here, so this may not work bug free, but the concept is there.) var LongListItem = Class.create(); LongListItem.prototype = { // <snip> onMouseDown: function (event) { if (!Event.isLeftClick(event)) {return;} Draggables.clear(); var div = document.createElement("div"); div.style.position = "absolute"; div.id = "draggable"; div.sourceItem = this; //set Position var offsets = Position.page(this.element); //Wrapper margin being counted twice? In Moz, what about others? var correction = Position.page($("wrapper")); div.style.left = (offsets[0] - correction[0]) + 'px'; div.style.top = (offsets[1] - correction[1]) + 'px'; var countPos = Position.page(this._getCountElement()); div.style.width = (countPos[0] - offsets[0] - correction[0]) + 'px'; var parent = $("wrapper"); parent.insertBefore(div, parent.firstChild); var d = new Draggable(div, {revert: false, ghosting: false, endeffect: function (element) { element._opacity = Element.getOpacity(element); new Effect.Opacity(element, {duration:0.5, from:element._opacity, to:0.0, afterFinish: function(obj) {Draggables.clear();} }); }, scroll: "rightContainers" }); d.initDrag(event); Draggables.updateDrag(event); } } Draggables.clear = function (event) { while (Draggables.drags.length) { var d = Draggables.drags.pop(); var e = d.element; d.stopScrolling(); d.destroy(); d.element = null; if (e.parentNode) {e.parentNode.removeChild(e)}; } } On Aug 7, 2006, at 2:21 PM, Greg Militello wrote: I am running into the same issue (as apparently most people)... |
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs