IE z-index bug affecting Youtube videos

I've been experimenting with the YouTube API and I've included the following code snippet in http://jsfiddle.net/aaronk85/wapFR/.

<div id="video-wrap2"></div>
<div id="video-wrap">
    <div id="play-video"></div>
</div>
<style>
#video-wrap2 {
    background-color: red;
    width: 666px;
    height: 666px;
    z-index: 1000;
    position: absolute;
}

#play-video {
    display: inline;
    float: left;
    height: 400px;
    width: 100%;
}

#video-wrap {
    float: left;
    display: inline;
    width: 610px;
    overflow: hidden;
    position: absolute;    
    z-index: 1;
}
</style>
<script>
$(document).ready(function() {
    $("#embed").replaceWith("<div id ='play-video'></div>");
    $.getJSON("https://gdata.youtube.com/feeds/api/playlists/UUJUAqHnkDX15IvFoXIGTm2A?alt=json-in-script&callback=?&max-results=1", function(data) {
        $.each(data.feed.entry, function(i, item) {
            var dataContainer = $("#play-video");
            var video = item.media$group.media$content[0].url;
            video = video.replace('https://www.youtube.com/v/','https://www.youtube.com/embed/');
            video = video.replace('version=3&f=playlists&app=youtube_gdata','wmode=opaque');
          $('#play-video').append("<iframe wmode='opaque' style='z-index:0;position:absolute;' width='610' height='400' src="+video+"' frameborder='0' name='vid-frame' id='vid-fade' allowfullscreen></iframe>");    
        });
    });
});
</script>

I'm trying to make video-wrap 2 appear on top of the video (random playlist I've selected). Everything seems to be working fine in all browsers except for IE. What am I missing in IE?

I've experimented with combinations of opaque/transparent but can't seem to get it right. Despite finding similar questions online and trying their solutions, I'm still facing difficulties.

Answer №1

Unique Demo

In the Internet Explorer web browser, the stack order for the z-index property may be reset for child elements based on the webpage layout.

In your specific case, you are also utilizing the position:absolute for all elements except the child element.

To remedy this issue, make sure to include position: absolute; in your CSS styles for the #play-video element.


This alternative Demo omits the use of z-index property and solely relies on setting position:absolute for the child element #play-video.

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

Update DataTable 1.9 while preserving existing rows

I'm currently using dataTables js version 1.9 Periodically, an ajax call is made to the server to retrieve information that should be displayed in a table every 60 seconds or so. Although I can easily clear and repopulate the table like this: $(id) ...

Tips for clicking a .class a random number of times:

Could someone help me figure out how to click a random number of times on the element with class name .CLASS when a key is pressed? I think I need to incorporate the Math.floor(Math.random()) function, but I'm not sure how to do it in my existing code ...

Data retrieval seems to be encountering issues in Firefox and IE9, whereas Chrome and Safari are functioning without any problems

I am using the following method function callCommentservice() { try { // Comment Service Url var getCommentServiceUrl = self.commentsServiceUrl + self.getRating + "tenantId=" + self.tenantId + "&ratedObjectTypeId=" + sel ...

"Implementing a seamless transition effect on two slideshows using jQuery's fadeslideshow

I currently have a homepage featuring a fadeslideshow with 5 slides. The fadeslideshow plugin being used can be found at http://plugins.jquery.com/project/fadeslideshow. On the homepage, there is also a menu bar with various menu items. When a user clicks ...

Having trouble getting your Raspberry Pi web server to display the background image?

Recently, I successfully set up a LAMP server on my raspberrypi which was quite exciting. One of the first things I did was configure an FTP server to transfer webpage files to the Pi. I managed to create a basic form of the final webpage and transferred i ...

Span tag not respecting CSS width property

One of my spans is causing an issue. Here are the styles in question: .form_container .col1che { float: left; width: 4%; text-align: left; } .form_container .col2che { float: left; width: 80%; text-align:left; } .form_container .col3che { float: ...

Updating dynamic content in IBM Worklight V6.1 with jQuery Mobile v1.4.3 requires waiting for the DOM to load

I need to dynamically update the content of a div within my HTML page structure. <!DOCTYPE HTML> <html> ... <body> <div data-role="page"> <div data-role="header"> //Image </div> <!-- Th ...

Is there a jQuery AJAX method that can be invoked during the waiting process for error, success, or completion?

As I was about to use an ajax function and looking through the API, a question popped into my head. Is there a way to execute a function while waiting for the success, error, done, etc. callbacks to be triggered? I wondered if there could be something lik ...

Tips for updating the appearance of material-ui table pagination

I'm looking to enhance the way table pagination is presented in material-ui. The current default display by material-ui looks like this: https://i.stack.imgur.com/d4k4l.png My goal is to modify it to look more like this: https://i.stack.imgur.com/A ...

customized webpage redirection based on visitor's IP address

I need assistance with redirecting the URL based on the visitor's IP address. The code I have seems to only direct visitors to AU, with all other conditions not working as expected. Any help would be greatly appreciated. Thank you! <script languag ...

Tips for effectively sizing a logo within a Bootstrap navbar

<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link ...

Trouble with Datatables when displaying data in input fields

I have been working on a project that involves using Datatables and encountered an issue with column export. The column displays successfully on the webpage but fails to display after using render as shown below: this._dataTable = this.$mainTable.DataTa ...

Unable to align the row in the center

I'm having trouble centering a row with 4 columns. It seems off when I look at the picture below, specifically at the vertical border under the "most read" blue square. html file: <div class="block-section"> <div class="sm-section-wrapper" ...

Element that hovers and floats

Just last week, I was working on coding a custom menu bar for my blog located at . However, when it came to adding social buttons, things went awry. It seemed like a float element issue! Despite my attempts to resolve it by adjusting widths and properties, ...

Remove the unnecessary space at the bottom of the Mat Dialog

I'm currently utilizing Angular Material within my Angular application. One issue I am facing is the excessive whitespace at the bottom of a dialog that displays information about a post. How can I reduce or eliminate this unnecessary space? Take a l ...

Can products be added with quantity and additional attributes from the Wishlist to the Cart on a Prestashop platform?

Can I add Wishlist products with quantity and other attributes to the Cart in Prestashop? I have implemented the following code in managewishlist.tpl to enable adding a product to the cart and removing it from the wishlist. <a class="button btn-defaul ...

Error in JavaScript: Uncaught TypeError - Unable to access the "left" property of an undefined object

This error is really frustrating and I've come across several inquiries regarding this console issue. It's not providing enough information in the chrome console for me to effectively troubleshoot. /** * Adjustment of dropdown menu positio ...

Unable to set the height for ul/div elements

I'm struggling to make my navbar appear when I click the "menu button". The div seems to be present in the code, but with a height of 0. Here's the relevant section of the code causing the issue. Any suggestions on how I can resolve this? var ...

Modify the text in an h1 tag using the hasClass() method

Recently, I was assisted with a script that dynamically adds the .hover class to 5 other classes at regular intervals. For those interested, you can view the complete code on this jsfiddle link. My ultimate goal is to associate specific text content with ...

Guide on adjusting PHP variable values and updating functions with ajax requests

One of my functions determines dates based on a variable For example: $modification = "+1 Week" function updateCalendar($change){ $month = array("January","February","March","April","May","June","July","August","September","October","November","Dece ...