Skip to content

Instantly share code, notes, and snippets.

@andreascarpello
Created March 2, 2015 10:55
Show Gist options
  • Save andreascarpello/e1a4c036603ae1c936e5 to your computer and use it in GitHub Desktop.
Save andreascarpello/e1a4c036603ae1c936e5 to your computer and use it in GitHub Desktop.
YouTube Video Embedded via iframe Ignoring z-index and cover html elements Flash Object And Z-Index: How To Make Them Play Nicely Together YouTube video content covering CSS drop down menus in IE < 9
/**
* Flash videos issue on IE:
* http://stackoverflow.com/questions/9074365/youtube-video-embedded-via-iframe-ignoring-z-index
* http://stackoverflow.com/questions/7747133/youtube-video-content-covering-css-drop-down-menus-in-ie-9
*/
//Fix z-index youtube video embedding
$('iframe').each(function() {
var url = $(this).attr("src");
if ($(this).attr("src").indexOf("?") > 0) {
$(this).attr({
"src" : url + "&wmode=transparent",
"wmode" : "Opaque"
});
}
else {
$(this).attr({
"src" : url + "?wmode=transparent",
"wmode" : "Opaque"
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment