Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ontouchstart不适用于svg元素_Svg_Raphael - Fatal编程技术网

Ontouchstart不适用于svg元素

Ontouchstart不适用于svg元素,svg,raphael,Svg,Raphael,我正在使用SVG创建一个圆 var gauge = mapSvg.circle(center['x'], center['y'], 85).attr({'stroke-width': 3, 'stroke': 'black', 'fill': 'white'}); 它在for循环中,这个圆创建了三次。我在点击时添加了ontouchstart gauge.node.ontouchstart = function () { alert("hi>>>>>") } 但此

我正在使用SVG创建一个圆

var gauge = mapSvg.circle(center['x'], center['y'], 85).attr({'stroke-width': 3, 'stroke': 'black', 'fill': 'white'});
它在for循环中,这个圆创建了三次。我在点击时添加了ontouchstart

gauge.node.ontouchstart = function () { alert("hi>>>>>") }
但此警报未显示。

这应该可以工作

var r = Raphael("blah",200,200);

var c = r.circle(100,100,100).attr({fill: 'red' }).touchstart( function() { alert('hi') });

当我用动态属性创建这个循环中的圆时,JSFIDLE不起作用。就像TouchStart只使用第一个参考一样,您可以发布一个JSFIDLE来突出问题,以及您使用的设备和浏览器。这是我的代码,我正在galaxy s2的默认浏览器上测试,提前感谢。确实,这需要一段工作代码,让人们来试验这个问题。类似这样的问题只有在Android默认浏览器中才会出现。在安卓chrome和安卓Mozilla中,它运行良好。我正在galaxy s2中测试它