javascript - 固定位置不会在其他浏览器中保持固定
问题描述
我有这个用于退出模式的图标,当在 Chrome 上向下滚动时它保持完全固定,但我注意到它在 Firefox 和 Safari 等其他浏览器中不起作用。我还注意到该图标在右上角有点偏离,但在一瞬间它会重新定位它应该在的位置。任何想法是什么原因造成的?是因为作为模态的父级是位置固定的,你不能在固定容器内有固定位置吗?我还在学习 HTML。
.outer {
position: fixed;
top: 0;
width: 70px;
cursor: pointer;
z-index: 3;
right: 0;
margin: 20px 20px 0px 0px;
}
.inner {
width: inherit;
text-align: center;
}
.inner::before, .inner::after {
position: absolute;
content: '';
height: 1px;
width: inherit;
background: #FFC107;
left: 0;
transition: all .3s ease-in;
#animatedModal3 {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
overflow-y: auto;
z-index: 9999;
opacity: 1;
animation-duration: 0.6s;
}
.inner::after {
bottom: 50%;
transform: rotate(-45deg);
}
.inner::before {
top: 50%;
transform: rotate(-45deg);
}
<div id="animatedModal3" class="bg-black">
<div class="close-animatedModal3 py-3 bg-black">
<div class="outer">
<div class="inner">
<label class="label2">Back</label>
</div>
</div>
</div>
</div>
解决方案
您有一个未在此处关闭的括号 .inner::before, .inner::after {...
推荐阅读
- node.js - 生成 Xvfb 时出现问题,服务器已经在运行
- ruby-on-rails - 根据条件查找第 N 个文档
- python - 在创建 deepVAR 模型时遇到元组索引错误
- notepad++ - 如何在最新的记事本++ 编辑器中启用文档列表面板?
- javascript - 类型文字中的计算属性名称必须引用其类型为文字类型或“唯一符号”类型的表达式
- android - 如何在 android studio gradle 中设置 aab 文件名
- html - 如何创建多个将设置分开的收音机类型?
- r - 安装Rcpp失败,出现很多错误
- python - 我如何找到一个图像在另一个图像中的百分比?
- r - 我想了解为什么我的 else if station 不工作