どうすれば最も正しい方法でこれを行うことができますか教えてください。特定のdivが表示されているときの色の変更
HTML:
<div id="fixed-red" class="fixed-red"></div>
<div id="fixed-green" class="fixed-green"></div>
<div id="fixed-blue" class="fixed-blue"></div>
<div id="red" class="red"></div>
<div id="green" class="green"></div>
<div id="blue" class="blue"></div>
CSS:私は追加/ユーザーはオン/オフred
、、またはblue
divの上にあるとき(fixed-red/green/blue
のdiv要素にred/green/blue-active
クラスを削除する
html,body{
height:100%;
}
.fixed-red,.fixed-green,.fixed-blue{
width:30px;
height:30px;
position:fixed;
top:10px;
left:10px;
background:#333;
}
.fixed-green{
top:50px;
}
.fixed-blue{
top:90px;
}
.red-active{
background:#f00;
}
.green-active{
background:#0f0;
}
.blue-active{
background:#00f;
}
.red,.green,.blue{
width:100%;
height:100%;
}
.red{
background:#900;
}
.green{
background:#090;
}
.blue{
background:#009;
}
表示されているとき)、小さいdivは、ユーザーが表示されているときに大きなdivの色でそれぞれ強調表示されます。
ありがとうございます!
の作業フィドルです'大きなdivsが、私は彼らが目に見えるかどうかを確認する方法を知らない – user7362793