id=canonをクリックしたらid=matchが出現してcanonをめがけて10px下がってから消える
感じにしたいのですが、jqueryでtransformは未対応なので他にどんな手段を用いればいいのか
悩んでいます。
HTML5
1コード <body id="firework"> 2 3 <div id="shoot"> 4 <figure class="img1"><img src="images/canon.png" alt="canon" id="canon"></figure> 5 <figure class="img2"><img src="images/machi.png" alt="machi" id="match"></figure> 6 <figure class="img3"><img src="images/firework.png" alt="firework" id="fire"></figure> 7 </div>
CSS3
1コード .firework { 2 position: relative; 3 height: 100%; 4} 5 6#canon { 7 position: absolute; 8 right: 30px; 9 bottom: 0; 10} 11 12.img2 { 13 position: absolute; 14 right: -100px; 15 bottom: 50px; 16 transform: translateY(10px); 17 transition: transform .1s; 18} 19 20.img3 { 21 position: absolute; 22 right: -30px; 23 top: 0; 24} 25#match { 26 opacity: 0; 27} 28 29#fire { 30 display: none; 31}
javascript
1コード $(function (){ 2 $('#canon').on('click',function() { 3 matchin(); 4 }); 5 function matchin() { 6 $('#match').animate({opacity: 1},500); 7 $('#match').animate({opacity: 0},1000); 8 } 9 });
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/09 03:08