Skip to content

Instantly share code, notes, and snippets.

@maripo
Created March 31, 2012 09:33
Show Gist options
  • Save maripo/2261282 to your computer and use it in GitHub Desktop.
Save maripo/2261282 to your computer and use it in GitHub Desktop.
Avoid z-index problem of Flash elements
var embeds = document.getElementsByTagName('EMBED');
for (var i=0, l=embeds.length; i<l; i++)
{
var embed = embeds[i];
embed.setAttribute('wmode', 'transparent');
var param = document.createElement('PARAM');
param.name = 'wmode';
param.value = 'transparent';
if ('OBJECT'==embed.parentNode.tagName)
{
embed.parentNode.appendChild(param);
}
else
{
// Wrap <embed> element with <object> element
var object = document.createElement('OBJECT');
object.appendChild(param);
embed.parentNode.appendChild(object);
object.appendChild(embed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment