我一直在試圖建立兩個標誌之間的淡入淡出效果兩個圖像之間的淡入淡出效果。他們互換,但看起來不太好。任何人都可以告訴我最好的方法來做到這一點?創建自己的類
這裏是我的代碼:
.header.affix .logo-second {
display: block;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.header.affix .logo-first{
display: none;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
<a data-scroll href="#home" id="brand" class="navbar-brand" style="padding-right: 100px;">
<!--
The URLs in the src attributes below have been replace by data: URLs
for demostration purposes
-->
<img src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" style="background: red"/>' class="logo-first" alt="">
<img src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" style="background: green"/>' class="logo-second" style="width: 70%; padding-top: 15px;">
</a>
– daveptd
你是如何觸發轉換的? – Shaggy
當它從.header變爲.header詞綴頭滾動 - 所以我說這其中隱藏標識的第一和具有標識的第二 – daveptd