Link to home
Create AccountLog in
Avatar of codequest
codequest

asked on

Drag Clone won't swap

In the attached test code, the intent is for the drag clone to change images when the drag goes back forth over the 400px left mark.

The 400px left point is recognized, and the CheckSwap function is evoked, but the drag clone just disappears.   It will appear if the drag is started on the right side of the page, but it won't drag, again indicating again that the CheckSwap function is evoked.

I tried other approaches like changing image but no joy.

Any help with getting this to swap the drag clone as the drag goes back and forth pass the 400px left mark OR, providing an explanation for why it can't work OR coming up with a different approach, would be appreciated.

Thanks!
DNDDragCloneSwapTest.htm
ASKER CERTIFIED SOLUTION
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of codequest
codequest

ASKER

Wow!  Works slick!  Happy happy!

FYI for future readers, I was able to delete this from CheckSwapDragClone.

dragClone.style.left = (X - (.5 * parseInt(dragClone.style.width, 10))) + 'px';
        dragClone.style.top = (Y - (.5 * parseInt(dragClone.style.height, 10))) + 'px';
        document.onmousemove = dragMove;

Open in new window