我一直在试图建立两个标志之间的淡入淡出效果两个图像之间的淡入淡出效果。他们互换,但看起来不太好。任何人都可以告诉我最好的方法来做到这一点?创建自己的类
这里是我的代码:
.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