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.
最佳答案
更新
我刚刚使用了您的pen
,一切正常,您忘记将type: 'iframe'
传递给fancybox
,您也是应该把你的js代码放在codepen
的js部分,这里是截图
这是代码笔的链接:Click me
关于javascript - Fancybox iframe 不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38730207/