D3.js:监听属性的变化?(D3.js: listen for changes to an attribute?)

在D3.js中,是否可以监听元素属性的更改?

例如,假设我有以下选择:

var myDiv = d3.select('#myDiv);

我有什么方法可以创建一个侦听器,只要myDiv的任何属性发生变化, myDiv能做什么?

Is it possible, in D3.js, to listen for changes to a element attribute?

For example, say I have the following selection:

var myDiv = d3.select('#myDiv);

Is there any way I can create a listener that will do something whenever any of myDiv's attributes change?

最满意答案

你不能在D3本身做到这一点。 这个问题在Javascript中有一些选项。

You cannot do this in D3 itself. This question has a few options in Javascript though.

更多推荐