我在d3.js甘特圖中有一個甘特圖。我使用滾動和縮放甘特圖:http://codepen.io/Pau/pen/FKzEaMouseevent div覆蓋div上的div
但我有問題。這是我的修改:http://codepen.io/anon/pen/pgVdgm當鼠標懸停在線或任務上時,我想添加mouseevent(簡單警報)。但是這沒有用。我說這個事件排隊和任務:
svg.select(".gantt-chart-canvas").append("line").attr(
{
"class":"verticalDeadLine",
"x1" : x(testDate),
"y1" : 0,
"x2" : x(testDate),
"y2" : height,
"fill" : "none",
"shape-rendering" : "crispEdges",
"stroke" : "red",
"z-index" : "550",
"stroke-width" : "2px"
}).on('mouseover', function(event) {
alert("abcd");
})
.on('mouseout', function() {
});
我認爲問題是在這條線,其中添加矩形,類窗格
chart.append("rect")
.attr("class", "pane")
.attr("width", width)
.attr("height", height-margin.top-margin.bottom)
.attr("transform", "translate(" + margin.left + ", " + margin.top + ")");
窗格中的CSS類:
.pane {
fill: none;
pointer-events: all;
}
這div封面線和任務mousevents。
的MouseEvent在線路和任務工作,當我在課堂上窗格改變:pointer-events: all;
到pointer-events: auto;
但這種改變後,我的縮放和滾動不行......
如何改變呢?我想放大滾動圖表和鼠標事件在線和任務工作。我想我必須改變行類pointer-events屬性。但是如何?
總結,更簡單的例子。我有兩節課。
<div class="A">
<div class="B">
</div">
</div">
這兩個類都有mousevent,但是A類覆蓋類B.如何設置這兩個mousevents的工作?
非常感謝您的幫助。 –