PDA

View Full Version : drag + drop


Tails
01-02-2003, 04:10 PM
I've seen the tutorial here at http://javascriptkit.com/howto/drag.shtml
but I have some oddly shaped imageds that have alot of whitespace. I want the image area to have the drag stuff, but not the background of it. I tried image maps, but I have not gotten very far with it. Is it possible to apply a similar drag&drop routine on <SHAPE>s in a <MAP> ? I'm trying to create one of those dollies where you can just drag clothing onto it. I've only seen it done with flash.

piz
01-02-2003, 04:16 PM
You have to do that with image-maps.
But you can't drag only a part of an image - you have to drag the total image.

Tails
01-02-2003, 04:24 PM
That's what I was afraid of. But does that mean that image maps cannot have events and styles added to their <SHAPE> tag? Such as onMouseOver enabling dragging and onMouseOut disabling it, but being applied to the shape rather than the image.

piz
01-02-2003, 04:29 PM
Of course you can define events in the shapes (afaik).
Why doesn't that work?


<map name="imgmap">
<area shape="rect" onclick="drag();" coords="11,10,59,29" >
<area shape="rect" coords="42,36,96,57">
</map>


instead of onclick you can use
href="javascript:drag();" also.

Tails
01-02-2003, 04:36 PM
Yes, thank you. I think that just might work.

piz
01-02-2003, 04:51 PM
the space in java script should not be there.
I think thats for security reaseons of he forum - but you have to write it together.

Tails
01-04-2003, 04:32 PM
The click addressdidn't work since it only applies when the user releases a button. But I have gotten this to work. Take a look at it: http://XFox_Prower.tripod.com/games/js/kiss