嘗試使用javascript創建一個使用懸停在li項目上的排序的「按鈕」,這將改變另一個li項目(phoneChange)的背景。這些項目圍繞手機的圖像,當我將鼠標懸停在相關的鋰項目上時,我會更改屏幕截圖。我一直在尋找一個類似的例子,一直沒有找到任何適合我的東西。點擊項目可以更改另一個背景圖片
<ol class="list-b">
<li class="firstPhone"><span class="title">First Box</span> Lorem ipsum sit dolor.</li>
<li class="secondPhone"><span class="title">Second Box</span> Lorem ipsum sit dolor.</li>
<li class="thirdPhone"><span class="title">Third Box</span> Lorem ipsum sit dolor.</li>
<li class="fourthPhone"><span class="title">Fourth Box</span> Lorem ipsum sit dolor.</li>
<li class="fifthPhone"><span class="title">Fifth Box</span> Lorem ipsum sit dolor.</li>
<li class="sixthPhone"><span class="title">Sixth Box</span> Lorem ipsum sit dolor.</li>
<li id="phoneChange" class="firstPhone"></li>
</ol>
CSS
.firstPhone{
background: url(../images/mobile1.png) }
.secondPhone{
background: url(../images/mobile2.png) }
.thirdPhone{
background: url(../images/mobile3.png)}
.fourthPhone{
background: url(../images/mobile4.png)}
.fifthPhone{
background: url(../images/mobile5.png)}
.sixthPhone{
background: url(../images/mobile6.png)}
你想讓圖片在懸停或點擊時更改嗎? –
工作樣本?或小提琴請 –