FancyBox iframe没有第二次关闭

jmy*_*ona 1 jquery jquery-plugins fancybox fancybox-2

我知道之前有人问过这个问题,但我无法让我的代码工作.

我启动了我的fancybox:

$(document).ready(function() {

            $('.fancybox').on('click', function(event) {
    event.preventDefault();
    $.fancybox({
        'type' : 'iframe',
        // hide the related video suggestions and autoplay the video
        'href' : this.href = this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1') + '&autoplay=1',
        'overlayShow' : true,
        'centerOnScroll' : true,
        'speedIn' : 100,
        'speedOut' : 50,
        'width' : 640,
        'height' : 480
    });
});

});
Run Code Online (Sandbox Code Playgroud)

然后调用iframe:

<a class="fancybox fancybox.iframe" href="http://vimeo.com/123456">
Run Code Online (Sandbox Code Playgroud)

但是,当我关闭弹出窗口,然后尝试打开时,视频没有显示,任何人都可以帮助我解决它,大多数解决方案都与'类型'有关:'内联'并且没有接缝可以使用我的示例.

非常感谢,

JFK*_*JFK 7

如果您使用的是fancybox v2.x,那么您的脚本中不需要(过时的)选项(v1.3.4).你宁愿这样做

1).设置你的html就好

<a class="fancybox" href="http://vimeo.com/123456">
Run Code Online (Sandbox Code Playgroud)

...删除特殊课程 fancybox.iframe

2).添加helpers media js文件,如:

<script type="text/javascript" src="../helpers/jquery.fancybox-media.js"></script>
Run Code Online (Sandbox Code Playgroud)

...相应地设置你的路径

3).使用这个脚本

jQuery(document).ready(function ($) {
    $('.fancybox').fancybox({
        helpers: {
            media: {}
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

......并为自己省去一些麻烦.

请参阅JSFIDDLE

如果需要,可以添加更多API选项.有关v2.x的选项,请访问http://fancyapps.com/fancybox/#docs