javascript - Draggable from HTML droppable on SVG -


I am using jquery draggable on some pins ... I should leave them on the paths on a SVG map that The path id I cant seem to work for it.

Here is a piece of my code. Ideally if I drag the sign-drag on this path, then I have to return the 'Map_1' by ID, but I do not have such a code like normal form Works with non SVG from

  & lt; Div class = "signal s 1 dragable" & gt; & Lt; / Div & gt; & Lt; Svg version = "1.1" id = "map" xmlns = "http://www.w3.org/2000/svg" xmlns: xlink = "http://www.w3.org/1999/xlink" x = " 0px "y =" 0px "visible box =" 0 0 540 360 "xml: space =" protected "& gt; & Lt ;! - areas - & gt; & Lt; G id = "state" & gt; & Lt; Ch & gt; & Lt ;! - AL - & gt; & Lt; Path class = "droppable al" id = "map_1" fill = "# EBECED" stroke = "#FFFFFF" stroke-width = "1" d = "m336.6199.5l-0.199,0.4 l 0.0.1.1 lb-3.301 , 32.399l0.9,17.5c1.6-0.399,2.4-0.699,2.4-1C-0.301-0.6-0.4-1.1-0.301-1.5 c0.101-1.5,0.5-1.899,1.101-1.3 c6, 0.5,1,1.4,1.399,2.7 c 0.301,1.3,0.801,1.9,1,5,1.6 c0301-0.199,1-0.5,1.9-0.8c 0.6-0.8,0.8-1.399,0.6-1.8 C-0.3-0.5-0.3-1.1,0-1.7 c0.301-0.7,0-1.2-0.8-1.5C -0.899-0.399-1.2-1.2-0.6-2.3h22.5c-0.4-1.6-0.601- 2.7 -0.3-3.3c0.199-0.7,0.199-2-0.301-3.8c-0.199-0.801-0.199-1.2-0.3-1.301c0-0.1,0.101-0.6,0.3-1.6c0.101-0.6,0.4 -1.2, 0.9-2c0.4-0.5,0.6-1.1.0.4-1.8 C-0.101-0.7-0.5-1.5-0.9-2.4 C-0.0-0.899-0.8-1.7-0.9-2.2 L-3.8-25.399 H 336.6z "/ & gt; & Lt; / G> & Lt; / G> & Lt; / Svg & gt;   

JS

  $ ('draggable'). Draggable (); $ ('Svg path.droppable'). Droppable ({Accept: '.draggable', drop: function (event, UI) {console.log ('event'); console.log (event); console.log ('Ui'); console.log (ui );}});    

Use this example ...

  var dropTargets = canvas.selectAll ("rect") data (type) .enter () .andend ("g") dropTargets.append ("rect") .attr ({width: 180 returns : (I * 110) + .5}, rx: 20, ry: 20, class: function (D, i) {return "color", height: 100, x: 10.5, y: function (D, I) + (I + 1)}} dropTargets.append ("text") .text (function (d) {return d}) .attr ({x: 25.5, dy: 30, y: function (d, i) {return ( I * 110) + .5}});   

Add SVG dynamically to use this way ...

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -