Troubleshooting z-index issue in HTML5 video when in full screen mode

Having some trouble with HTML5 video on a non-app mobile page. I've added text over the video using an overlay div. It works fine in normal mode, but the z-index doesn't seem to work when the video is in full-screen mode. I've been struggling with this issue for a while now and despite searching on Google, StackOverflow, and CSS-tricks, I haven't found a solution yet.

Here is my code:

(function($, d) {
    $.each(readyQ, function(i, f) {
        $(f)
    });
    $.each(bindReadyQ, function(i, f) {
        $(d).bind("ready", f)
    })
})(jQuery, document)
.vcontainer {
    position: relative;
}

.vcontainer video {
    position: relative;
    z-index: 0;
}

.voverlay {
    position: absolute;
    top: 4%;
    left: 4%;
    z-index: 1;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

video::-webkit-media-controls-fullscreen-button {
    display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<section class="footer-links">
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-sm-12">
                <div class="section-title text-justify">
                    <div class="vcontainer responsive float-center" id="myvideo">
                        <video width="100%" height="auto" controls controlsList="nodownload" poster="" data-setup='{}'>
                            <source src="video.mp4"/>
                        </video>

                        <div class="voverlay">
                            <p>
                                <span class="float-right sm-12 badge badge-danger">Student Name Reg-212111</span>
                            </p>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
</section>

Answer №1

I suggest updating the fullscreen functionality of the video and managing it within the parent container of the video tag along with your text content. This way, you can utilize the id 'myVideo' for reference.

    function toggleFullscreen() {
    let elem = document.querySelector("video");
    let elem2 = document.getElementById("myvideo");
    if (!document.fullscreenElement) {
        elem2.requestFullscreen().catch(err => {
            alert(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`);
        });
    } else {
        document.exitFullscreen();
    }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Align an item to the border of the screen (maintain original markup)

Consider the following code snippet: <div> <p>blah blah</p> <img src="..."> <p>blah blah</p> </div> Is there a way to align the img element to either the right or left side of the screen, which may not nece ...

Designing responsive websites involves ensuring that all text remains within the designated div tags

I'm currently developing a website and aiming to ensure it is responsive. However, I am facing an issue where the text does not dynamically adjust according to the content size. Any suggestions or assistance would be greatly appreciated. Thank you! ...

Can the submit ID value be utilized in PHP?

name="submit" functions as expected. if(isset($_POST["submit"])) <input type="submit" ID="asdf" name="submit" value="Save" class="ui blue mini button"> I want to change it to use ...

"Trouble with Bootstrap custom checkbox or radio buttons being unresponsive to clicks

How come this code isn't functioning properly? <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="ano ...

The thickness of the tooltip border appears more pronounced in Microsoft Edge

My table displays a value when I hover over it. In Google Chrome, it appears like this: https://i.sstatic.net/dHTKx.png However, in Microsoft Edge, it looks like this: https://i.sstatic.net/mqNC0.png I haven't made any changes to it, so it seems ...

Encountering a challenge in developing a personalized, digital keyboard with CSS grid in React where some buttons are not appearing on the screen

Attempting to develop an on-screen keyboard for a React application using CSS grid to partition the containing element. Despite setting the necessary display properties and grid template, only 4 buttons are appearing, with most of them hidden below one ano ...

Why is the CSS selector `:first-child:not(.ignore)` not working to exclude the `ignore` class from the selection?

Is there a way to utilize the first-child selector with the not(.ignore) selector to target every element that is the first child of its parent, except when that first child has the class ignore? I've experimented with :first-child:not(.ignore){...}, ...

Solving the right-to-left orientation issue in the Bootstrap navbar

I have implemented a navbar using the code below, which aligns well from the right side. However, the menu items are sorted in ltr order and I need them to be in rtl order, so that "Dropdown 1" starts from the right side of the page. Currently, it appears ...

Resolving syntax error to enable dismissible device alerts

I am attempting to make my devise alerts dismissible. According to the bootstrap documentation found at this link, adding data-dismiss="alert" is necessary. However, when I try to implement this into my application layout as shown below, a syntax error oc ...

What is the reason for receiving HTTP headers in addition to non-HTML data when parsing a webpage in Java?

I have attempted various methods to extract data from the internet, but all of them end up pulling the header along with the file I'm trying to save: Take the following code for example: URL url; String webURL = "http://www.wunderground.com/history/ ...

What is Reddit's secret to producing a clean top header with no margins?

While inspecting the code in Chrome Developer Tools, I noticed that when I tried to replicate it on my website, it didn't function the same way. I realized that setting margin: 0; eliminated the margins, but shouldn't the margins technically be ...

Multiple layers of SVG text with consistent widths and dynamic heights

I have a challenge in mind where I want to implement a text effect that automatically adjusts its width while maintaining proportional heights. My goal is to stack multiple words on top of each other to create a visual style similar to the example image b ...

Flask is having trouble loading images within the static directory

I am facing an issue with loading two images in my HTML when the 'next' button is clicked. Initially, everything was working fine before I integrated the front end with Flask. The CSS and JS files are functioning properly, but the images are not ...

Has the "use strong" feature in Javascript been acknowledged as a standard for web development?

Google began testing a new method called "use strong" as a more rigid option compared to the existing javascript "use strict". There hasn't been much information about it since it was discussed in their blog post: https://developers.google.com/v8/ex ...

The jQuery dynamic fields vanish mysteriously after being validated

I am facing an issue with my jQuery and validation. Below is the code snippet causing the problem: var fielddd = 1; $(document).on('click', '.btn.add-field', function() { fielddd++; $('#newfield').append('< ...

Having trouble relocating the navbar logo to the left side

I've been struggling to adjust the logo position by moving it slightly to the left, but all my attempts so far have failed. Initially, I thought the issue might be due to the .main_nav_container or the container and a <div col-lg-12> wrapping, ...

Display or conceal all sections based on selected dropdown options within the Elementor plugin

I have a dropdown menu with 9 different sections underneath 1. Section id=Hige x 3 2. Section id=Medium x 3 3. Section id=Low x 3 My goal is to show only the sections that correspond to the selection made in the dropdown menu. I am using jQuery to achi ...

Reset the button is behaving in the same way as the submit button

I'm having an issue with the script below where the reset button is acting like a submit button as well. Can anyone help me troubleshoot this problem? Thank you. HTML <input type="image" name="submit" value=" " src="image.png"> <input t ...

launch hyperlink in bootstrap popup

I have a challenge with showcasing multiple videos in a single modal without creating separate modals for each button. The function I found was effective with an older version of Bootstrap, but it no longer works with Bootstrap 3.3.7. Below is the HTML co ...

Updating CSS when input field value changes using jQuery

var emailFooter = $('footer#footer input.email'); var emailFooterLength = emailFooter.val().length; var hiddenCaptcha = $("footer#footer .captcha-hide"); emailFooter.focus( function() { hiddenCaptcha.css("disp ...