Javascript 如何使用svg.js从自定义事件访问元素
使用svg.js,如何从自定义事件访问元素Javascript 如何使用svg.js从自定义事件访问元素,javascript,svg.js,Javascript,Svg.js,使用svg.js,如何从自定义事件访问元素 myCircle.on('someEvent', function(event) { var circleX = event.x(); // event.x is not a function circleX = event.target.x() // event.x is not a function circleX = event.target.x() // event.target.x is not a function
myCircle.on('someEvent', function(event) {
var circleX = event.x(); // event.x is not a function
circleX = event.target.x() // event.x is not a function
circleX = event.target.x() // event.target.x is not a function
circleX = this.x() // this is undefined
});
用这个。在中,单击事件可以工作,但不能使用此选项。在自定义事件中
有什么想法吗?要从事件中获取元素,可以使用事件属性target
...
let element = SVG.get(event.target.id);
...