Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Fancybox打开SWF文件时动态更改维度_Javascript_Jquery_Flash_Size_Fancybox - Fatal编程技术网

Javascript 使用Fancybox打开SWF文件时动态更改维度

Javascript 使用Fancybox打开SWF文件时动态更改维度,javascript,jquery,flash,size,fancybox,Javascript,Jquery,Flash,Size,Fancybox,我有一个ul与图像和swf文件的链接横幅。单击链接后,Fancybox将打开其覆盖并显示图像/swf文件 问题是,无论swf文件的尺寸是多少,Fancybox总是显示大约580*390的覆盖。这当然会扭曲swf文件的视图 我一直在修补自动缩放之类的东西,但没有结果…:- 这是我的代码: $("a.fancybox").attr('rel', 'gallery').fancybox({ 'transitionIn' : 'none', 'transitionOut'

我有一个ul与图像和swf文件的链接横幅。单击链接后,Fancybox将打开其覆盖并显示图像/swf文件

问题是,无论swf文件的尺寸是多少,Fancybox总是显示大约580*390的覆盖。这当然会扭曲swf文件的视图

我一直在修补自动缩放之类的东西,但没有结果…:-

这是我的代码:

$("a.fancybox").attr('rel', 'gallery').fancybox({
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'titlePosition'     : 'inside',
    'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
        return '<span id="fancybox-title-inside">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    }   
});
Fancybox是否有任何方法可以检测swf文件的尺寸,并由此确定覆盖的尺寸

请注意,我在数据库或其他地方没有swf文件的维度。 另外请注意,图像和swf总是随机混合的

焦急地等待您的回复

问候,


也许您可以使用FancyBox的自动缩放或自动标注选项。如以下文件所述:


您不能使用jquery获取swf的维度,并使用fancybox文档中指定的宽度和高度选项将它们传递到fancybox代码中。

如前所述,解决方案是在单独的PHP页面中显示SWF文件,在该页面中通过SWFObject设置SWF的高度和宽度,然后使用fancybox的iframe源设置。在后端,您将SWF传递到此文件,就这样

谢谢,但是这些设置不起作用。我的叠加保持了上面描述的相同维度。这听起来是一个很好的解决方案。如何通过jquery来确定维度?您需要按照以下步骤进行:var mySwfWidth=$'idOfSwf'.width;var mySwfHeight=$'idOfSwf'。高度;然后在fancybox的属性中有:width:mySwfWidth,height:myswfheights问题是SWF是从外部加载的,而不是内联加载的。我已经看到,您可以使用php getimagesize$path_或_url;,找到维度;,但整个过程似乎非常复杂…你有一个lnk到页面吗?我想我已经设法自己解决了。现在,我将swf文件包装在一个PHP文档中,在该文档中,我使用SFWObject设置了高度和宽度。因此,我在Fancybox中使用iframe设置。在我的后端,我只需检查它是否是swf文件,然后将其传递给display-flash.php,瞧。看来是个好办法。你怎么认为?
autoScale   true    If true, FancyBox is scaled to fit in viewport
autoDimensions  true    For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results