Jump to content

Overlay and Caption on Hover for Videos

Go to solution Solved by tuanphan,

Recommended Posts

  • Replies 29
  • Views 4.6k
  • Created
  • Last Reply

Top Posters In This Topic

48 minutes ago, tuanphan said:

Which exact code did you try?

I actually just realized I could use a section ID instead, and that worked! When I just used a specific block ID, the hover effect didn't work.

section[data-section-id="657dd35569daf04c17c39128"] {
  .video-caption-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 60%;
    text-align: center;
    color: #EBE9E5;
    font-size: 10px;
    z-index: 50000;
    pointer-events: none;
    opacity: 0.75;
    transition: all 1s;
  }
  .video-block .intrinsic:after {
    content: "";
    background-color: rgba(68, 58, 49, .75);
    display: block;
    top: 10%;
    left: 15%;
    width: 70%;
    height: 80%;
  	border-radius: 25px;
    z-index: 20000;
    position: absolute;
    opacity: 0;
    transition: all 1s;
  }
  .video-block:hover .intrinsic:after {
    opacity: 1;
    transition: all 1s;
  }
  .video-block:hover .video-caption-wrapper {
    opacity: 1;
    transition: all 1s;
  }
}

 

Link to comment
On 2/18/2024 at 11:48 AM, JamIsJam88 said:

I actually just realized I could use a section ID instead, and that worked! When I just used a specific block ID, the hover effect didn't work.

section[data-section-id="657dd35569daf04c17c39128"] {
  .video-caption-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 60%;
    text-align: center;
    color: #EBE9E5;
    font-size: 10px;
    z-index: 50000;
    pointer-events: none;
    opacity: 0.75;
    transition: all 1s;
  }
  .video-block .intrinsic:after {
    content: "";
    background-color: rgba(68, 58, 49, .75);
    display: block;
    top: 10%;
    left: 15%;
    width: 70%;
    height: 80%;
  	border-radius: 25px;
    z-index: 20000;
    position: absolute;
    opacity: 0;
    transition: all 1s;
  }
  .video-block:hover .intrinsic:after {
    opacity: 1;
    transition: all 1s;
  }
  .video-block:hover .video-caption-wrapper {
    opacity: 1;
    transition: all 1s;
  }
}

 

Use Block ID doesn't work because this class name = ID

If you use a block id wrap around all code, the code will be invalid so it doesn't work

image.thumb.png.066cb6c0eb337c920fbd1762c125e938.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 2/20/2024 at 3:31 AM, tuanphan said:

Use Block ID doesn't work because this class name = ID

If you use a block id wrap around all code, the code will be invalid so it doesn't work

image.thumb.png.066cb6c0eb337c920fbd1762c125e938.png

Oh okay. Good to know. Thanks! The section ID works great, so I'm okay with that.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.