我一直在試圖在我的網站上製作這個菜單,並且第一步是在點擊它時進行擴展。每張圖片都是獨立的,但在同一個div中。我應該如何以最好的方式做到這一點?如何使我的6張圖片向外擴展jQuery?
<script src="jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="index.css">
<body>
<div id="prototype">
<img style="height: 100px; width: 100px; position: absolute;"src="prototype1.png" alt="menu1">
<img style="height: 100px; width: 100px;position: absolute;" src="prototype2.png" alt="menu2">
<img style="height: 100px; width: 100px;position: absolute;" src="prototype3.png" alt="menu3">
<img style="height: 100px; width: 100px;position: absolute;" src="prototype4.png" alt="menu4">
<img style="height: 100px; width: 100px;position: absolute;" src="prototype5.png" alt="menu5">
<img style="height: 100px; width: 100px;position: absolute;" src="prototype6.png" alt="menu6">
</div>
我的jQuery到目前爲止
$("#prototype").one('click', function(){
$(this).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400).animate({
'width': '+=400px',
'height': '+=700px'}, "slow");
});
然後我的CSS:
#prototype {
position: absolute;
top: 45%;
left: 47.5%;
}
不幸的是,這是它的結局看起來像。
嘗試'transform:scale(2);'在其中一個圖像上,你想要類似的東西嗎? –
@CagatayUlubay不幸的是,它只是使它反彈,正如網站上顯示的那樣。我只是希望它增長,使文本更容易看到。 –