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)...

Anyone have a working example of this?  

-Greg

On Aug 7, 2006, at 12:31 PM, Tom Gregory wrote:

I've also done this. (In #1, I meant move the "Draggable" to a different DOM position, not the "Droppable", which is the same intent as Ryan's solution.)

It certainly is tricky to implement.  To save me the trouble of trying to move around the "ghost," I created one at the "onclick", made it a Draggable, then manually kicked off the drag sequence.


TAG

On Aug 7, 2006, at 10:21 AM, Ryan Gahl wrote:

A 3rd option, which is what I use, is on drag start create a clone of the draggable item (just like if you use the ghosting option), and attach the cloned element at the _document_ level. This doesn't require you to break your design by showing overflow for items you want to keep the overflow hidden.. although it is slightly trickier to implement.



On 8/7/06, Tom Gregory <[EMAIL PROTECTED]> wrote:
Actually, it's working just like the CSS standard says it's supposed
to.  This problem can be a pain.

This has been addressed on this list several times; here are some
possible solutions. (This assumes you wish to drag the item outside
of your scrolled list.)
1. Move the droppable outside (make it a sibling of) its original
container.
2. On start drag, set the list style to overflow:visible


TAG

On Aug 7, 2006, at 1:22 AM, Brian Feliciano wrote:

> I have a droppable and draggable implementation. works pretty much
> well except when my droppables are on a scrollbar (created via
> overflow:auto) since my droppables are on a list.
> seems that the droppables aren't working well with scrollbars and
> overflow.
>
> please help!
>
> thanks!
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to