fancybox jquery插件打开但youtube视频仍然在后台可见

时间:2012-10-14 14:16:44

标签: php javascript jquery fancybox fancybox-2

我正在使用fancybox2插件。

当我单击图像滑块工作但youtube视频仍然在后台可见时。

html代码控制嵌入视频

<iframe width="344" height="229" src="http://www.youtube.com/embed/o6qNGUAciB4" frameborder="0" allowfullscreen=""/>

和javascript代码

<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="<?=$this->session->CI->config->config['js_path'];?>/jquery.mousewheel-3.0.6.pack.js"></script>

<!-- Add fancyBox -->
<link rel="stylesheet" href="<?=$this->session->CI->config->config['css_path'];?>/jquery.fancybox.css?v=2.1.1" type="text/css" media="screen" />
<script type="text/javascript" src="<?=$this->session->CI->config->config['js_path'];?>/jquery.fancybox.pack.js?v=2.1.1"></script>

<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="<?=$this->session->CI->config->config['css_path'];?>/jquery.fancybox-buttons.css?v=1.0.4" type="text/css" media="screen" />
<script type="text/javascript" src="<?=$this->session->CI->config->config['js_path'];?>/jquery.fancybox-buttons.js?v=1.0.4"></script>
<script type="text/javascript" src="<?=$this->session->CI->config->config['js_path'];?>/jquery.fancybox-media.js?v=1.0.4"></script>

<link rel="stylesheet" href="<?=$this->session->CI->config->config['css_path'];?>/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
<script type="text/javascript" src="<?=$this->session->CI->config->config['js_path'];?>/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<script type="text/javascript">
var j= jQuery.noConflict();
j(document).ready(function() {
    j(".fancybox").fancybox({
        maxWidth    : 800,
        maxHeight   : 600,
        fitToView   : false,
        width       : '70%',
        height      : '70%',
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
        helpers : { 
               overlay: {
                opacity: 1, // or the opacity you want 
                css: {background: 'white'} // or your preferred hex color value
               } // overlay 
              } // helpers
    });
});
</script>

1 个答案:

答案 0 :(得分:1)

womde=opaque添加到您的YouTube链接(src),例如:

<iframe width="344" height="229" src="http://www.youtube.com/embed/o6qNGUAciB4?wmode=opaque" frameborder="0" allowfullscreen=""></iframe>

(顺便说一句:我个人更喜欢处理链接而不是文本代码因为我可以使用调试工具来帮助找到文本代码可能无法显示的其他可能的问题;)