标签云

微信群

扫码加入我们

WeChat QR Code

On the left of my screen, i've a SVG world map (one path for each country). I control it with D3jsOn the right, i've a HTML list (ul) of people.I'm looking for a solution to drag the name of one people and drop it in one country (with a effect for the country when the element pass over it).I don't ask a complete code but just concept or method to focus my search.Thanks a lot and have a good day !!


Here is the first google result for "svg element hover". Look's like it's possible to bind javascript events to SVG-elements. Sounds like a fun project. Good luck.

2019年09月24日40分46秒

Try giving your shape a fill and listen to the drop event—it might work: stackoverflow.com/a/9956710/395910

2019年09月24日40分46秒

Thanks for your answers !! I've maybe a solution : interact.js. I've just make some (little) tests and the interaction between htm element and svgseems to be good.Terry, i'm not sure that your link is the good, isn't it ?

2019年09月24日40分46秒

I have done a similar code. The HTML5 standard drag and drop support was unreliable sometimes. jquery draggable worked just fine.

2019年09月24日40分46秒

Peter Thanks a lot ! I will test the Jquery draggable... and I keep in touch with you!

2019年09月24日40分46秒