0

我曾经使用版本 2,我想使用更新的版本进行更新。

大多数时候,我使用它通过调用 PHP 页面在我的窗口中打开一个窗口。

请在下面找到我的 JS 函数来调用一个花哨的框 2:

function fancybox(url, modal, width, height, parameters, title, refresh) {

  $.fancybox({
    width: width,
    height: height,
    fitToView: false,
    autoSize: true,
    autoScale: false,
    transitionIn: 'none',
    transitionOut: 'none',
    type: 'iframe',
    beforeClose: function() {
        if (refresh !== undefined) {
            eval(refresh);
        }
    },
    href: url + '?' + parameters,
    modal: modal,
    title: title,
    helpers: {
        title: {
            position: 'top',
            type: 'inside'
        }
    }
});

现在我的呼叫 JS 有这个功能:

fancybox('annonce-detail.php', false, 200, 200, 'nunati=' + 0504+ '&copaip=' + 0454+ '&objet=' + objet, undefined, 'refresh()');

今天我想让它进化以适应这个新版本。问题是我不能用新版本做这种新功能。请在下面找到我的研究开始:

$.fancybox.open({
    iframe : {
        tpl :url + '?' + parameters,
        css : {
               width: width,
               height: height
        }
}                           
});

我什至无法用 php 页面打开一个花式框

您能否告诉我我的请求是否可行,也许我可以使用您的一些帮助。

先感谢您,

4

1 回答 1

0

您只需查看文档 - http://fancyapps.com/fancybox/3/docs/#api - 并遵循新语法:

$.fancybox.open({
    src  : 'YOUR LINK',
    type : 'iframe',
    opts : {
        iframe : {
            css : {
                width  : WIDTH,
                height : HEIGHT,
            }
        },
        beforeClose : function( instance, current ) {
            console.info( 'closing!' );
        }
    }
});

顺便说一句,请不要在 GitHub 问题和此处重复

于 2017-11-07T08:16:15.190 回答