Multiple canvas layers and mousemove
问题 I'm trying to use a mousemove event on a canvas, inspired from Wayne's answer here, and the corresponding fiddle. The problem is, I'm working with a code which creates "layered" canvas in the following way: // canvas data layers ["marks", "foreground", "brushed", "highlight", "clickable_colors"].forEach(function(layer, i) { canvas[layer] = selection .append("canvas") .attr({ id: layer, //added an id for easier selecting for mouse event class: layer, style: "z-index: " + i +10000000 })[0][0];