Fancybox iframe没有出现

时间:2016-08-02 20:51:07

标签: javascript jquery iframe fancybox

HTML

<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas">Youtube (iframe)</a>

此代码行有效,但我想动态添加javascript代码。

JS

'<li>' +
'<div class="list-left">' +
'<img src="' + thumb + '">' +
'</div>' +
'<div class="list-right">' +
'<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/' + videoID + '"><h3>' + title + '</h3></a>' +
'<small>By <span class="Title">' + channelTitle + '</span> on ' + videoDate + '</small>' +
'<p>' + description + '</p>' +
'</div>' +
'</li>' +
'<div class="clearfix"></div>' +
'';

当我点击链接时,我无法使用fancybox打开。它打开了新的页面和控制台说

Mixed Content: The page at 'https://www.youtube.com/embed/OFMSUI7PAS8'
was loaded over HTTPS, but requested an insecure image 
'http://www.youtube.com/favicon.ico'. This content should also be served over HTTPS.

1 个答案:

答案 0 :(得分:1)

<强>更新

我刚刚使用了您的pen,一切正常,我忘了将type: 'iframe'传递给fancybox,您也应该将您的js代码放入{{1}的js部分},这里是截图

enter image description here

以下是codepen的链接:Click me