所以我用@keyframe动画删除了css代码中最后一个问题的答案中的不透明度,由于某些原因,它只起作用一次。帮助?
header {
transition: height 600ms ease-in;
animation: yourAnimation 1s forwards 1s ease;
/* Define the dropdown-content transition styles on opacity, where
the opacity delay causes opacity of menu items to change after menu
animation (of 1sec) is complete */
.dropdown-content {
display: grid;
animation: yourAnimation 1s forwards 1s ease;
}
/* CSS modifier class for "header.open" causes height to change
when open class applied */
&.open {
height: 100%;
grid-template-rows: 50px 400px;
grid-row-gap: 20px;
grid-template-areas: 'dp logo start' 'dc dc dc';
}
/* When open modifier class applied to parent header, items in the
.dropdown-content child are set to be opaque/visible */
&.open .dropdown-content {
opacity: 1.0;
animation: yourAnimation 1s forwards 1s ease;
}
}
发布于 2019-09-26 16:44:36
您需要设置迭代次数:
animation-iteration-count: 2; // 0-infinite
https://www.w3schools.com/cssref/css3_pr_animation-iteration-count.asp
https://stackoverflow.com/questions/58109341
复制相似问题