【发布时间】:2020-03-04 17:47:32
【问题描述】:
我正在创建一个全屏介绍页面。 我需要创建一个下拉列,将背景颜色从深色变为浅色并显示内容。但我需要将主标题(文本)剪裁为背景颜色 - 在动画过程中它会发生变化。
这里是JSFiddle
SCSS
.header{
display: flex;
flex-direction: column;
position: relative;
height: 100%;
.overlay{
display: flex;
flex-direction: row;
align-items: flex-end;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1;
.col{
flex: 1;
width: 100%;
height: 100%;
background-color: black;
}
}
.content{
flex: 1;
display: flex;
flex-direction: column;
> div{
flex: 1;
}
.title{
position: relative;
color: white;
z-index: 2;
}
.posts{
display: flex;
position: relative;
z-index: 0;
a{
display: block;
width: 100%;
height: 100%;
background: lightblue;
text-align: center;
}
}
}
}
还有 JS
$(document).ready(function(){
setTimeout(function () {
$(".overlay .col").each(function (i) {
var col = $(this);
setTimeout(function () {
if(!col.hasClass('animated')){
col.addClass('animated');
col.slideUp(500);
}
}, 150 * i);
});
}, 500);
});
动画之间也有一些小故障,我想知道为什么会发生这种情况
已解决
添加到.header
background: white;
和.header .content .title {
mix-blend-mode: exclusion;
【问题讨论】:
-
只是为了确认,你想要的是当条纹动画完成/正在发生时,h1 文本应该是黑色的。我说的对吗?
-
@AKNair 当动画发生时 - 当背景光和相反时,文本的一部分变暗
标签: javascript jquery html css animation