PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, May 5, 2022

[FIXED] Why is my photo overlapped by my video's player when hovered?

 May 05, 2022     css, html, image, overlap, video     No comments   

Issue

Basically when hovered, my image is *2 scaled and it overlaps my video as I expect it to, the problem is that it only overlaps my video, not the player with the timer and the play button of my video. I've tried to add a z-index: 2 in .voyage-image:hover but it seems like it has no effect. So, what i'd like is when hovered, the image overlaps the video AND the player... Thanks for your help :)

Also, I'm a MacOS user and using 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>
    


Solution

Try this one!

.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>

In here I have add another class to the third div and set its z-index to 1.

Thanks and best regards!



Answered By - Vishal Kalansooriya
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing