Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用$.fancybox()onclick打开Youtube视频_Jquery_Fancybox - Fatal编程技术网

Jquery 使用$.fancybox()onclick打开Youtube视频

Jquery 使用$.fancybox()onclick打开Youtube视频,jquery,fancybox,Jquery,Fancybox,我正在尝试使用以下代码在灯箱中打开Youtube链接: <a href="#" onclick="$.fancybox( ['http://www.youtube.com/watch?v=123'] );">Click me</a> lightbox启动,但不是Youtube播放器,它只是URL的静态文本。HTML标记 使用的代码是从谷歌的快速搜索中找到的 <a class="video" title="The Falltape" href="http:/

我正在尝试使用以下代码在灯箱中打开Youtube链接:

<a href="#" onclick="$.fancybox( ['http://www.youtube.com/watch?v=123'] );">Click me</a>

lightbox启动,但不是Youtube播放器,它只是URL的静态文本。

HTML标记

使用的代码是从谷歌的快速搜索中找到的

 <a class="video"  title="The Falltape" href="http://www.youtube.com/v/ZeStnz5c2GI?fs=1&amp;autoplay=1"><img src="images/1.jpg" alt="" /></a>
jQuery(document).ready(function() {

   $(".video").click(function() {
       $.fancybox({
         'padding'      : 0,
         'autoScale'    : false,
         'transitionIn' : 'none',
         'transitionOut': 'none',
         'title'        : this.title,
         'width'        : 640,
         'height'       : 385,
         'href'         : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
         'type'         : 'swf',
         'swf'          : {
             'wmode'            : 'transparent',
             'allowfullscreen'  : 'true'
          }
       });

       return false;
   });
});