jQuery fancyBox YouTube视频无效

Raj*_*nth 1 php youtube wordpress xmlhttprequest fancybox

我正在使用WordPress并使用jQuery fancyBox显示YouTube视频,但我收到此错误:

XMLHttpRequest cannot load http://www.youtube.com/embed/L9szn1QQfas?autoplay=1. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
Run Code Online (Sandbox Code Playgroud)

jQuery code在footer.php中添加了bellow

$(document).ready(function() {
    $(".fancybox").fancybox();
});
Run Code Online (Sandbox Code Playgroud)

并在我的帖子中添加了低于html的代码.

<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas?autoplay=1">
    <img class="alignleft size-thumbnail wp-image-583" alt="small-screen-youtube" src="http://localhost/example/wp-content/uploads/2013/10/small-screen-youtube-150x150.png" width="150" height="150" />
</a>
Run Code Online (Sandbox Code Playgroud)

这个问题杀了我:(

任何想法或建议?谢谢.

小智 7

<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas?autoplay=1">
<img class="alignleft size-thumbnail wp-image-583" alt="small-screen-youtube" src="http://localhost/example/wp-content/uploads/2013/10/small-screen-youtube-150x150.png" width="150" height="150" />
</a>
Run Code Online (Sandbox Code Playgroud)

您需要做的就是解决这个问题:将'fancybox.iframe'更改为'fancybox iframe' - 删除点(.),为我工作.