gpt4 book ai didi

javascript - 具有当前 View 位置的 css 动画整页

转载 作者:行者123 更新时间:2023-11-30 16:07:31 24 4
gpt4 key购买 nike

我用 css 创建了两个动画 https://codepen.io/anon/pen/yOqxdq html 和 css

<img onclick="show(this);" src="http://tigersincrisis.com/wp-content/uploads/2014/01/image_21.jpg">

@keyframes shadow {
0% { opacity: 0;height: 0; transform : scale(0.1);}
100% { opacity: 1; height: 100%;transform : scale(1);}
}
@keyframes show {
0% { opacity: 0;margin: 20% auto;width: 20%;height: 20%;}
100% { opacity: 1;margin: 0; width: 100%;height: 100%;}
}
#show {
position: absolute;
left: 0;
bottom: 0;
text-align: center;
background-color: rgba(0, 0, 0, 0.76);
animation-name: show;
animation-duration: 2s;
animation-fill-mode: forwards;
z-index: 5;
}
#show-item{

position: relative;
margin: 0 auto;
animation-name: shadow;
animation-duration: 3s;
animation-fill-mode: forwards;
opacity: 0;
padding-top: 40px;
}
#show-item img{
border: 4px solid black;

}
a#closeShow{
position: relative;
float: right;
text-decoration: none;
color: #C8C8C8;
padding: 6px 10px;
background: rgba(0, 0, 0, 0.9);
border-radius: 26px;
height: 18px;
position: relative;
top: 25px;
left: 10px;
border: 2px solid #e0e0e0;
box-shadow: 0 0 2px black;
}

问题是当用户滚动时, View 发生变化,具有绝对位置的 div 保持在上方,并且显示框不显示在页面下方的部分

最佳答案

尝试 position: fixed; #show

演示:FIDDLE

关于javascript - 具有当前 View 位置的 css 动画整页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36812159/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com