为什么我的照片在悬停时与我的视频播放器重叠?
Why is my photo overlapped by my video's player when hovered?
基本上,当鼠标悬停时,我的图像会按 *2 缩放,并且会像我预期的那样与我的视频重叠,问题是它只与我的视频重叠,而不是带有计时器的播放器和视频的播放按钮。我试图在 .voyage-image:hover 中添加一个 z-index: 2 但它似乎没有效果。所以,我想要的是悬停时,图像与视频和播放器重叠......感谢您的帮助:)
此外,我是 MacOS 用户并使用 Brave!
.fiche-voyage {
width: 100vw;
}
.voyage-image-row {
width: 50%;
display: flex;
margin: 0 auto;
justify-content: space-around;
}
.voyage-media-container {
width: 50%;
padding: 15px;
text-align: center;
display: flex;
align-items: center;
}
.voyage-image,
.voyage-video {
width: 100%;
}
.voyage-image:hover {
transform: scale(2);
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
z-index: 2;
}
<div class="fiche-voyage">
<div class=" voyage-image-row">
<div class="voyage-media-container">
<div class="voyage-media-align">
<img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
<p>caption</p>
</div>
</div>
<div class="voyage-media-container">
<div class="voyage-media-align">
<video controls="controls" class="voyage-video">
<source src="video1.mp4">
</video>
<p>caption</p>
</div>
</div>
</div>
</div>
试试这个!
.fiche-voyage {
width: 100vw;
}
.voyage-image-row {
width: 50%;
display: flex;
margin: 0 auto;
justify-content: space-around;
}
.voyage-media-container {
width: 50%;
padding: 15px;
text-align: center;
display: flex;
align-items: center;
}
.voyage-image,
.voyage-video {
width: 100%;
}
.voyage-image:hover {
transform: scale(2);
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
z-index: 2;
}
.top{
z-index: 1;
}
<div class="fiche-voyage">
<div class=" voyage-image-row">
<div class="voyage-media-container top">
<div class="voyage-media-align">
<img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
<p>caption</p>
</div>
</div>
<div class="voyage-media-container">
<div class="voyage-media-align">
<video controls="controls" class="voyage-video">
<source src="video1.mp4">
</video>
<p>caption</p>
</div>
</div>
</div>
</div>
在这里,我在第三个 div 中添加了另一个 class,并将其 z-index 设置为 1。
谢谢并致以最诚挚的问候!
基本上,当鼠标悬停时,我的图像会按 *2 缩放,并且会像我预期的那样与我的视频重叠,问题是它只与我的视频重叠,而不是带有计时器的播放器和视频的播放按钮。我试图在 .voyage-image:hover 中添加一个 z-index: 2 但它似乎没有效果。所以,我想要的是悬停时,图像与视频和播放器重叠......感谢您的帮助:)
此外,我是 MacOS 用户并使用 Brave!
.fiche-voyage {
width: 100vw;
}
.voyage-image-row {
width: 50%;
display: flex;
margin: 0 auto;
justify-content: space-around;
}
.voyage-media-container {
width: 50%;
padding: 15px;
text-align: center;
display: flex;
align-items: center;
}
.voyage-image,
.voyage-video {
width: 100%;
}
.voyage-image:hover {
transform: scale(2);
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
z-index: 2;
}
<div class="fiche-voyage">
<div class=" voyage-image-row">
<div class="voyage-media-container">
<div class="voyage-media-align">
<img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
<p>caption</p>
</div>
</div>
<div class="voyage-media-container">
<div class="voyage-media-align">
<video controls="controls" class="voyage-video">
<source src="video1.mp4">
</video>
<p>caption</p>
</div>
</div>
</div>
</div>
试试这个!
.fiche-voyage {
width: 100vw;
}
.voyage-image-row {
width: 50%;
display: flex;
margin: 0 auto;
justify-content: space-around;
}
.voyage-media-container {
width: 50%;
padding: 15px;
text-align: center;
display: flex;
align-items: center;
}
.voyage-image,
.voyage-video {
width: 100%;
}
.voyage-image:hover {
transform: scale(2);
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
z-index: 2;
}
.top{
z-index: 1;
}
<div class="fiche-voyage">
<div class=" voyage-image-row">
<div class="voyage-media-container top">
<div class="voyage-media-align">
<img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
<p>caption</p>
</div>
</div>
<div class="voyage-media-container">
<div class="voyage-media-align">
<video controls="controls" class="voyage-video">
<source src="video1.mp4">
</video>
<p>caption</p>
</div>
</div>
</div>
</div>
在这里,我在第三个 div 中添加了另一个 class,并将其 z-index 设置为 1。
谢谢并致以最诚挚的问候!