Published:
February 26, 2012How to fix flash object z-index
If any of your html element is getting hide behind the flash object such as youtube video player, or any flash player/object
Then you should call this function on body load.
function fix_flash_z_index() {
// loop through every embed tag on the site
var embeds = document.getElementsByTagName(’embed’);
for (i = 0; i < embeds.length; i++) {
embed = embeds[i];
var new_embed;
// everything but Firefox & Konqueror
if (embed.outerHTML) {
var html = embed.outerHTML;
// replace an existing wmode parameter
if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'");
// add a new wmode parameter
else
new_embed = html.replace(/
Example to call this function
$(document).ready(function () {
fix_flash_z_index();
});