如何将fancybox附加到打开pdf文件的iframe上

时间:2013-02-19 09:19:43

标签: javascript iframe fancybox

我在脚本文件中有以下java代码

$(".various").fancybox({
                maxWidth    : 1035,
                maxHeight   : 850,
                fitToView   : false,
                width       : '70%',
                height      : '70%',
                autoSize    : false,
                closeClick  : false,
                openEffect  : 'none',
                closeEffect : 'none'
            });

以下

html = html
                        + "<li><a href=\""
                        + pdfUrl
                        + "\" onclick=\"trackFactsheetView("+surveyId+",\'pdf\')\" class=\".iframe\" data-fancybox-type=\"iframe\" >View Facts</a></li>";

...给我

<a class=".iframe" data-fancybox-type="iframe" onclick="trackFactsheetView(44,'pdf')" href="public/filespool/0/44/US_Atlantic_East_Coast_Program-_USGS-2010.pdf">View Facts</a>

加载时不会在文档上生成a链接。一旦触发事件,它们就会在对话框中创建。

但是当我点击此链接时,它会在浏览器上打开pdf文件,而不是在iframe中打开。

1 个答案:

答案 0 :(得分:0)

我将课程改为fancybox。它现在正在运作