FancyBox Iframe 没有第二次关闭 [英] FancyBox Iframe not closing second time

查看:15
本文介绍了FancyBox Iframe 没有第二次关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我启动了我的幻想箱:

$(document).ready(function() {$('.fancybox').on('click', function(event) {event.preventDefault();$.fancybox({类型":iframe",//隐藏相关视频建议并自动播放视频'href' : this.href = this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1') + '&autoplay=1','overlayShow' :是的,'centerOnScroll':是的,'speedIn':100,速度输出":50,宽度":640,身高":480});});});

然后调用 iframe:

<a class="fancybox fancybox.iframe" href="http://vimeo.com/123456">

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

非常感谢,

解决方案

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

1).设置你的html喜欢

<a class="fancybox" href="http://vimeo.com/123456">

...删除特殊类fancybox.iframe

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

<script type="text/javascript" src="../helpers/jquery.fancybox-media.js"></script>

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

3).使用这个脚本

jQuery(document).ready(function ($) {$('.fancybox').fancybox({帮手:{媒体: {}}});});

...省点麻烦.

参见JSFIDDLE

如果需要,您可以添加更多 API 选项.查看 http://fancyapps.com/fancybox/#docs 了解 v2.x 的选项p>

I know this question was asked before however I cannot get my code to work.

I have my fancybox initiated:

$(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
    });
});

});

and then iframe is called:

<a class="fancybox fancybox.iframe" href="http://vimeo.com/123456">

But when I close popup and then try to open that again video is not showing up, could anyone help me to resolve it, most of solutions relates to 'type' : 'inline' and doesnt seams to work with my example.

Many thanks,

解决方案

If you are using fancybox v2.x, then you don't need the (obsolete) options (v1.3.4) in your script. You could rather do

1). Set your html like

<a class="fancybox" href="http://vimeo.com/123456">

... removing the special class fancybox.iframe

2). Add the helpers media js file like :

<script type="text/javascript" src="../helpers/jquery.fancybox-media.js"></script>

... set your path accordingly

3). use this script

jQuery(document).ready(function ($) {
    $('.fancybox').fancybox({
        helpers: {
            media: {}
        }
    });
});

... and save yourself some headaches.

See JSFIDDLE

You could add some more API options if you need them. Check http://fancyapps.com/fancybox/#docs for the options of v2.x

这篇关于FancyBox Iframe 没有第二次关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆