こんにちは私はJSONから自動生成されたHTMLファイルを持っています。 DOMを生成すると、サブレイヤーとサブレイヤーを持つレイヤーがあります。子要素にホバー効果を追加するCSS/jquery
各divをホバリングすると、ホバリングされたレイヤの境界線が表示されている必要があります。追加しようとしました:divに移動しますが、メインのdivにのみ適用されます。他のものはそれの下にあるので、影響を与えません。まだ動作していないポインタイベントを使用して試行します。以下にコードが追加されました。 「大きな」のdivは、DOMツリー内の最後だったので感謝
.layer {
position: absolute;
border: 1px solid transparent;
}
.layer:hover {
border: 1px solid blue;
pointer-events: auto;
}
<body>
<div>
<div class="layer" style="left: 215px; top: 79px; width: 234px; height: 35px;">
Layer
<div class="layer" style="left: 0px; top: 0px; width: 234px; height: 35px;">
Layer
<div class="layer" style="left: 0px; top: 0px; width: 234px; height: 35px;">
Layer
<div class="layer" style="left: 0px; top: 0px; width: 234px; height: 35px;">Layer</div>
</div>
</div>
</div>
<div class="layer" style="left: 220px; top: 153px; width: 256px; height: 57px;">Layer
<div class="layer" style="left: 0px; top: 0px; width: 130px; height: 23px;">Layer</div>
<div class="layer" style="left: 14px; top: 29px; width: 39px; height: 23px;">Layer</div>
<div class="layer" style="left: 0px; top: 27px; width: 256px; height: 30px;">Layer
<div class="layer" style="left: 0px; top: 0px; width: 256px; height: 30px;">Layer</div>
</div>
</div>
<div class="layer" style="left: 496px; top: 147px; width: 256px; height: 72px;">Layer
<div class="layer" style="left: 0px; top: 6.125px; width: 130px; height: 23px;">Layer</div>
<div class="layer" style="left: 14px; top: 35.375px; width: 39px; height: 23px;">Layer</div>
<div class="layer" style="left: 0px; top: 33px; width: 256px; height: 30px;">
<div class="layer" style="left: 0px; top: 0px; width: 256px; height: 30px;"></div>
</div>
</div>
<div class="layer" style="left: 220px; top: 219px; width: 256px; height: 72px;">
<div class="layer" style="left: 0px; top: 6.125px; width: 130px; height: 23px;"></div>
<div class="layer" style="left: 14px; top: 35.375px; width: 39px; height: 23px;"></div>
<div class="layer" style="left: 0px; top: 33px; width: 256px; height: 30px;">
<div class="layer" style="left: 0px; top: 0px; width: 256px; height: 30px;"></div>
</div>
</div>
<div class="layer" style="left: 496px; top: 219px; width: 256px; height: 72px;">
<div class="layer" style="left: 0px; top: 6.125px; width: 130px; height: 23px;"></div>
<div class="layer" style="left: 14px; top: 35.375px; width: 39px; height: 23px;"></div>
<div class="layer" style="left: 0px; top: 33px; width: 256px; height: 30px;">
<div class="layer" style="left: 0px; top: 0px; width: 256px; height: 30px;"></div>
</div>
</div>
<div class="layer" style="left: 220px; top: 291px; width: 256px; height: 72px;">
<div class="layer" style="left: 0px; top: 6.125px; width: 130px; height: 23px;"></div>
<div class="layer" style="left: 14px; top: 35.375px; width: 39px; height: 23px;"></div>
<div class="layer" style="left: 0px; top: 33px; width: 256px; height: 30px;">
<div class="layer" style="left: 0px; top: 0px; width: 256px; height: 30px;"></div>
</div>
</div>
<div class="layer" style="left: 220px; top: 373px; width: 117px; height: 40px;">
<div class="layer" style="left: 14px; top: 8px; width: 89px; height: 23px;">
<div class="layer" style="left: 0px; top: 0px; width: 89px; height: 23px;"></div>
</div>
<div class="layer" style="left: 0px; top: 0px; width: 117px; height: 40px;">
<div class="layer" style="left: 0px; top: 0px; width: 117px; height: 40px;"></div>
</div>
</div>
<div class="layer" style="left: 162px; top: 33px; width: 700px; height: 475px;">
<div class="layer" style="left: 0px; top: 0px; width: 700px; height: 475px;"></div>
</div>
<div class="layer" style="left: 0px; top: 0px; width: 1024px; height: 541px;">
<div class="layer" style="left: 0px; top: 0px; width: 1024px; height: 541px;"></div>
</div>
</div>
</body>
あなただけの最も上のdivに置くため? divの幅と高さを変更する – guradio