PDA

View Full Version : drag and drop problem


carlitos_way
04-16-2007, 12:02 PM
Hi all, i found a nice script for drag&drop and i'm trying to use it.

so i put it in this page (http://www.viniolindog.it/test/dinanno/) and it works.


but when i put it in this other page (http://www.viniolindog.it/test/home.html) it doesn't work... can you tell me why?? :confused:

david_kw
04-16-2007, 06:32 PM
I think the problem is with your getStyle() function. It is a tricky thing getting the actual computed style. It doesn't always return the location. It can also return things like "auto" which is happening in the one that doesn't work. Then your parseInt() is returning NaN which is an invalid setting for style.top so the rest of your code which counts on there being a value in style.top then fails.

One way you might be able to test it is to add a check to getStyle() such that if the return value is "auto" it will instead return "0". It will cause some jumping in your graphic but might help you narrow down the problem.


if (strValue == "auto") strValue = "0";
return strValue;


Not really a solution in the end. You might have to do the offsetParent thing to calculate the starting position.

david_kw