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.
答案 0 :(得分:1)
<强>更新强>
我刚刚使用了您的pen
,一切正常,我忘了将type: 'iframe'
传递给fancybox
,您也应该将您的js代码放入{{1}的js部分},这里是截图
以下是codepen的链接:Click me