css - 如何使 div 过渡不那么刺耳?
问题描述
我建立了一个画廊,当用户单击图像时,它会变成全屏。但是,全屏图像过渡非常刺耳,我不确定如何使其平滑。我试过使用transition
选择器,但没有运气。有没有人对如何最好地制作动画有任何建议?这是我的代码:
body {
margin: 0em 9em;
}
h1 {
font-family: 'Russo One', sans-serif;
text-align: center;
font-size: calc(90px + 1.5vw);
}
.gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.image-container {
flex: 1 1 30%;
margin: 1em;
max-height: 40em;
box-shadow: 0.3rem 0.4rem 0.4rem rgba(0, 0, 0, 0.4);
}
.gallery img {
width: 100%;
height: 100%;
object-fit: cover;
align-content: center;
object-position: center;
}
#fullpage {
display: none;
position: fixed;
z-index: 9999;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-size: contain;
background-repeat: no-repeat no-repeat;
background-position: center center;
background-color: black;
}
<div class="container">
<h1>Photo Gallery</h1>
<div class="gallery"></div>
//When the user clicks an image,
//it becomes the background of this
//div and the display becomes block
<div id="fullpage">
<button
type="button"
data-close
onclick="fullpage.style.display='none'"
>
<span aria-hidden="true">×</span>
</button>
</div>
</div>
解决方案
推荐阅读
- javascript - 在 JavaScript 中上传之前减小 PDF 文档大小?
- xml - 用文件名替换目录和所有子目录中所有 Xml 文件的 Xml 属性值
- iis - 如何从创建 CSR 时生成的文件(一个 .cer 和一个 .keystore 文件)中获取私钥?
- r - 在“R”中创建一个矩阵,该矩阵中的每个元素都是另一个矩阵
- r - CRAN 检查:警告小插图引擎 knitr::rmarkdown 不可用
- jestjs - 如何获取当前运行测试的绝对路径?
- sql - SQL Server:为 XML 导入创建表;使用连接列制作主键
- r - ggplot2 Geom_Plot R labeling points in scatter plot
- c++ - How to check if an element in an array subtracted from another element will equal a third element
- java - 使用 Spring Data JDBC 的奇怪的一对多行为