2017-07-03 109 views
0

我有一個麻煩的任務。應該隱藏圖像,默認顯示按鈕。我想顯示圖像並隱藏按鈕,但是當一個動畫結束時,應該開始secound。過渡應該持續1秒鐘。如何做到這一點?Css動畫隊列

所有代碼: https://jsfiddle.net/169vuuk8/

HTML代碼:

<div class="showSingle" itemprop="1"> 
    <img src="https://img.thegearpage.net/board/data/avatars/m/47/47608.jpg?1487188345" alt="logo"> 
    <button class="button">button </button> 
</div> 
+1

@keyframe是您的朋友懸停 – Chiller

回答

0

不確定您需要的是什麼,但在圖像下方第一秒會淡出,延遲時間爲2秒後會熄滅按鈕。

.showSingle img { 
 
    opacity: 0; 
 
    animation: fadeInImage 1s ease-out forwards; 
 
} 
 

 
.showSingle button { 
 
    opacity: 1; 
 
    animation: fadeOutButton 1s ease-out 2s forwards;} 
 

 
@keyframes fadeInImage { 
 
    to { 
 
    opacity: 1 
 
    } 
 
} 
 

 
@keyframes fadeOutButton { 
 
    to { 
 
    opacity: 0 
 
    } 
 
}
<div class="showSingle" itemprop="1"> 
 
    <img src="https://img.thegearpage.net/board/data/avatars/m/47/47608.jpg?1487188345" alt="logo"> 
 
    <button class="button">button </button> 
 
</div>

+0

,IMG應該隱藏,之後該動畫按鈕應顯示 – Kamczatka