Rob Clayburn
2005-Sep-02 10:55 UTC
[Rails-spinoffs] altering revert effect based on if dropped on given droppable?
Hi All Does any one know how to specify a different reverteffect on a draggable if its successfully dropped on a given droppable? What I need to do is when an image is dragged onto a droppable image I want the drop image to be replaced with the drag image, the drag image to fade out and then reappear where it was at the start of the drag, as opposed to the draggable scrolling across the page back to where it was origionally if it wasn''t dropped in the correct place this is my droppable code: Droppables.add(''page1'', { accept: ''image'', hoverclass: ''drophover'', onDrop: function(element, lastActive) { $(''current_image1'').src = element.src ; element.options.reverteffect = new Effect.FadeAndRevert(element); } } ); I''ve hacked together this into effects.js Effect.FadeAndRevert = function(element) { options = Object.extend({ from: 1.0, to: 0.0, afterFinish: function(effect) { alert(element.style.left);//ok this works element.style.width = "330px"; // and this oEl = $(element); oEl.style.left = ''500px'' //and this effect.setOpacity(1); } }, arguments[1] || {}); return new Effect.Opacity(element,options); } maybe my brain is too tired but I can''t see how in the FadeAndRevert function I can get the drag images origional location before it was dragged? Any thoughts on a postcard please Rob C