Hi again Suni, I had the same idea a couple of weeks before actually, but I didn't continue my work because I noticed it would become even worse than the current Interface implementation.
Imagine you change/add/remove a drop target later on, or you change drop targets during the drag: You always have to recall the cloning. Also, cloning is not faster than measuring out I think. Try to stick it to dragstart if you want. 2006/11/28, Juha Suni <[EMAIL PROTECTED]>:
Here goes with another approach. This preserves the original draggable with no need for a helper, but still allows using event.target for all its goodness. Might need a bit more coding to implement this in interface, but at least it seems to work pretty well in this another proof of concept. As before, only Firefox tested. Making browser compatible should not be a hassle once the concept is working. Instead of fooling around with the helper we keep the original draggable but either on drag start or on document load clone the droppables, place them over themselves, and give the new clones a class that gives them a higher z-index and an opacity of 0. Therefore the original droppables stay at bottom (lowest z-index), the draggable happily drags over them, but the draggable itself stays below the invisible droppable-clones, that provide us with event.target. From there we can go on targetting the actual droppables as needed pretty easily. The only drawbacks I would see is if it takes too much performance to clone the droppables, or to calculate dimensions and to place them correctly on the view. Clones also need not be real copies, could always be just invisible divs. This would need further testing. My test here with 160 droppables (positioned absolutely, makes this test easier and causes less strain, I suppose) however performs really well and there is only a miniscule delay at document load. This is in a way pretty similar as the interface's 1) approach, but could be a lot faster with absolutely positioned elements, and there might be a way to exploit this with other types of elements too. Test it out here: http://www.sparecom.fi/test/test.php Im not totally happy about this yet, though. Have to dig in deeper with more time. In the end, I start to agree that it might be better to provide at least 2 modes for the draggables to function in, depending on the amount of droppables. -- Suni _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
-- Paul Bakaus Web Developer ------------------------ Hildastr. 35 79102 Freiburg
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/