I have the same problem on YouTube iframe embeds only in internet explorer though.
Z-index was being ignored totally, or the flash video was just appearing at highest index possible.
This was what I used, slight adapting the above jquery script.
My embed code, straight from YouTube...
<iframe width="560" height="315" src="http://www.youtube.com/embed/QldZiR9eQ_0?rel=0" frameborder="0" allowfullscreen></iframe>
The jQuery slighty adapted from the above answer...
$('iframe').each( function() {
var url = $(this).attr("src")
$(this).attr({
"src" : url.replace('?rel=0', '')+"?wmode=transparent",
"wmode" : "Opaque"
})
});
Basically if you don't select Show suggested videos when the video finishes in your embed settings, you have a ?rel=0
at the end of your "src"
url. So I've added the replace bit in case ?rel=0
exists. Otherwise ?wmode=transparent
won't work.