[Support request] Making video fill page hero container

Home Forums Support [Support request] Making video fill page hero container

Home Forums Support Making video fill page hero container

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1929584
    Dan

    Hey, I am trying to recreate an old theme in GP. I followed David’s tutorial from here. https://docs.generatepress.com/article/page-hero-background-video/
    I created the container and added the HTML snippet to it and added the CSS to the customizer. The staging site URL is in the private info. I am trying to make the video full width like the production site and have the wording and a play button that’s linked to a youtube video overlay it. The video should auto-play and loop and be muted. I tried a few variations of code I found in the forum and got close but the video won’t scale correctly any way I do it.
    Any help with this would be appreciated.
    Thanks
    Dan

    #1929668
    Elvin
    Staff
    Customer Support

    Hi Dan,

    Can you provide a mockup image of how you want it to be laid out?

    While waiting, if you have aspect ratio concerns on video scaling, you have to change this CSS:

    video[poster] {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }

    to this:

    video[poster] {
        object-fit: cover;
        width: 100%;
        height: auto;
    }
    #1929955
    Dan

    Hey, The production site I shared in the private info is what I need it to look like. I am replicating the looks of the current old handmade theme and using Generatepress so they can update things themselves easier going forward.

    #1929988
    Dan

    I just realized I gave you the wrong URL for what I was following. It was this, https://generatepress.com/forums/topic/cover-video-cdn/

    #1930374
    Dan

    I’ve been messing with this all morning. I can’t get the video to size itself to the container. I want the video container to have a max height of 535px. Then have the wording overlayed directly in the center of it. And it should scale to mobile.
    Not sure why this is fighting me so badly on this, lol.
    Thanks

    #1930800
    Elvin
    Staff
    Customer Support

    Try replacing the CSS you’re using to this:

    .has-video-bg {
        position: relative;
        overflow-y: hidden;
        min-height: 535px;
        display: flex;
        align-content: center;
        justify-content: center;
    }
    
    .has-video-bg video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        z-index: 0;
    }
    
    .has-video-bg .gb-inside-container {
        display: flex;
        flex-direction: column;
    }
    
    .video-container-content {
        position: relative;
        z-index: 1;
        margin: auto;
        color:white;
    }	
    

    Here’s what it’d look like – https://share.getcloudapp.com/OAunNmOd

    #1932507
    Dan

    Hey, Thanks for this! One more question, how can I get this to scale a little bit better on mobile?
    https://share.getcloudapp.com/mXuKWm5p I can change the font size but it still doesn’t scale like I think it should. Do I need a smaller image?
    Thanks

    #1933288
    Elvin
    Staff
    Customer Support

    Make a separate media rule for mobile.

    try this:

    @media (max-width:768px){
    .has-video-bg video {
        object-fit: cover;
        height: 100%;
        width: auto;
    }
    }
    #1933670
    Dan

    That’s perfect! Thank You so much.

    #1934896
    Elvin
    Staff
    Customer Support

    No problem. Glad to be of any help. 😀

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.