我希望畫廊頁面工作的方式是,當按鈕被按下時,圖像將把圖片帶到中間,並使其成爲相同的CSS(大小和白色陰影),然後其他圖像將與另一個CSS(有黑色的影子更小)我怎麼能這樣做,當我按下按鈕的圖像會切換?
HTML代碼:
<img id="Football" src="https://w-dog.net/wallpapers/3/12/331652870386587/club-stadium-sees-camp-nou-football-game-wallpaper-the-field-camp-nou-barcelona-spain-barcelona-the-player-match-sports-andres-iniesta.jpg" alt="Football">
<img id="Boxing" src="http://i.lv3.hbo.com/assets/images/sports/boxing/fights/2015-05-02-mayweather-vs-pacquiao/slideshow/mayweather-vs-pacquiao-ss-03-1024.jpg" alt="Boxing">
<img id="Basketball" src="http://wallpapercave.com/wp/WNc38uX.jpg" alt="Basketball">
CSS代碼:
#Boxing{
width:550px;
height:300px;
position:absolute;
margin-left:-200px;
margin-top:350px;
border-radius:10px;
z-index:-1;
opacity:0.8;
box-shadow: 0px 0px 100px black;
}
#Football{
width:550px;
height:400px;
position:relative;
margin-left:550px;
margin-top:300px;
box-shadow: 0px 0px 50px white;
border-radius:10px;
}
#Basketball{
width:550px;
height:300px;
position:absolute;
margin-left:-900px;
margin-top:350px;
border-radius:10px;
z-index:-1;
box-shadow: 0px 0px 100px black;
opacity:0.9;
}
向我們展示您到目前爲止獲得的js。 – gaynorvader
我實際上沒有,我是初學者在javascript –
好吧,你可以嘗試使用一個類來確定它應該是什麼樣子,看看[this](https://stackoverflow.com/questions/195951/change-一個元素級與 - 的JavaScript) – gaynorvader