If you don’t set the wmode on a flash embed it will float over the top of an overlay which can be a pretty big deal. This is ideal in environment with lots of legacy video code or where users will be posting new code and teaching them about wmode is a lost cause. This should work in all browsers.
$("embed").attr("wmode", "opaque");
var embedTag;
$("embed").each(function(i) {
embedTag = $(this).attr("outerHTML");
if ((embedTag != null) && (embedTag.length > 0)) {
embedTag = embedTag.replace(/embed /gi, "embed wmode="opaque" ");
$(this).attr("outerHTML", embedTag);
} else {
$(this).wrap("<div></div>");
}
});
This is such a useful snippet. Thanks! CSS-Tricks rocks!
thanks =D
awesome!
one note: escape backslashes or alternating quotes are needed on this line:
embedTag = embedTag.replace(/embed /gi, “embed wmode=”opaque” “);
thanks!
Can’t get this to work in Chrome anyone have any ideas? seems to work perfectly in safari and firefox.
Thank you! You spent me a lot of time.
Good solution Chris. But I am getting issue is some time google ad don’t specify transparent or opaque parameter in their flash ad embedded inside iframes. so i could nt bring any overlay over that ad. help.
ref – http://coding.scribd.com/2010/11/13/flashheed-fixing-the-flash-z-index-problem-for-ads/
Unfortunately not working for flash elements that are embedded inside iframes, anyone has an solution for that?
Thanks in advance.
Thanks for the nice trick with css !
Hi,
wmmode =”transparent” is working good for flash animation. Like that i want for jquery .. plz give me a solution…