<script type="text/javascript"> // FireFox is easy to handle $("embed").attr("wmode", "opaque"); // IE requires more work $(document).ready(function() { 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); } }); }); </script>
A short note about the IE specific code. I take no notice of existning WMODE-attributes. You might want to strip existing WMODES first before appending the new one to the EMBED-tag.
EDIT:
Okay, thing ain't always as easy as the seem to. A page in FireFox with lots of graphics would require another approach (only change is that the EMBED-tag is wrapped by a DIV inside the for-loop (originally for IE)):
<script type="text/javascript"> // FireFox $j("embed").attr("wmode", "opaque"); $j(document).ready(function() { // IE var embedTag; $j("embed").each(function(i) { embedTag = $j(this).attr("outerHTML"); if ((embedTag != null) && (embedTag.length > 0)) { embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" "); $j(this).attr("outerHTML", embedTag); } // This "else" was added else { $j(this).wrap("<div></div>"); } }); }); </script>

5 comments:
Nice. THanks
Helps to explain - opaque is better than transparent: http://stackoverflow.com/questions/886864/differences-between-using-wmodetransparent-opaque-window-for-an-embedded
Thank you very much !
brilliant thx
Good solution. 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/
Post a Comment