问题
I am running into a weird issue and can't seem to find a solution. Using either JqueryTools tabs widget or JqueryUI tabs widget when a Youtube video is embedded it keeps overlaying it on every tab. This only occurs in IE, specifically tested with IE10. Anyone know why?
I created a jsfiddle to better illustrate this issue: http://jsfiddle.net/ncfbX/19/
Edit:
Wouldn't let me submit it without including some code, so:
HTML:
<div class="main">
<div class="slides">Slides division</div>
<div id="tabs">
<ul>
<li><a href="#tabs-1">tab1</a></li>
<li><a href="#tabs-2">tab2</a></li>
<li><a href="#tabs-3">tab3</a></li>
</ul>
<div id="tabs-1">
<div class="inner_panel">
<p>working</p>
<iframe width="531" height="270" src="http://www.youtube.com/embed/7_nyhwuEX2c?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<div id="tabs-2">
<div class="inner_panel">
<p>Tab2 should not have a youtube video embedded.</p>
</div>
</div>
<div id="tabs-3">
<div class="inner_panel">
<p>Tab3 should not have a youtube video embedded.</p>
</div>
</div>
</div>
</div>
CSS:
.inner_panel{height:350px;}
JAVASCRIPT:
$(document).ready(function(){
$('#tabs').tabs();
});
回答1:
Alright I found a fix, apparently it had something to do with Youtube not respecting the dynamically assigned z-index.
Use the following code when embedding a Youtube video under tabs inorder to get it to work correctly with IE10:
<iframe title="YouTube video player" width="480" height="390" src="[YOUR_YOUTUBE_URL_HERE]?wmode=transparent" frameborder="0" wmode="Opaque">
?wmode=transparent at the end of the URL and wmode="Opaque" as an extra parameter is what makes it work.
来源:https://stackoverflow.com/questions/14410162/youtube-embedded-overlays-on-each-tab-for-ie10