2013-03-28 101 views
0

On my webpage, I have a link to a video. The link itself works fine, if I want the user to navigate away to the video and watch it, but I am wanting it to pop up in a lightbox for viewing on-click, instead.Set <a href> name to open a specific video when supplying a link

An example of this working can be found at this link

+0

请问您能否进一步阐明您的意思是“像某人点击了视频本身”的行为? –

+0

所以我去这个链接:http://continentalgold.com/English/investors/media-center/video-gallery/default.aspx#aniVid和动画视频弹出在灯箱,就像它当你点击在上面。 – user2221160

+0

视频的文件类型是什么? – Sandro

回答

1

您在该链接提供的示例使用fancybox(特别是版本1.3.4),您可以在http://fancybox.net/找到该示例。它背后的魔力并不在name标签中,而是在class中应用于a

具体如下a标签写的是:

<a href="http://example.com/video/12345678" class="fancyboxiframe">link text</a> 

而下面的脚本在运行时创建我认为你正在寻找的效果:

$('a.fancyboxiframe ,.Video a[href*="vimeo"]').fancybox({ 
    'type': 'iframe', 
    'height': 464, 
    'width' : 853 
}); 

这将激活fancybox jQuery插件,它告诉浏览器,当你点击链接时你想要做什么是在基于iframe的灯箱中弹出它。

根据API:

'类型':强制内容类型。可以设置为“图像”,“阿贾克斯”,“IFRAME”,“SWF”或“内联”

尝试采取先查看网站上的插件文档。使用起来非常简单,并且应该为您提供您正在寻找的内容,并以上述脚本作为示例。

+1

@ user2221160如果您不想专门使用Fancybox,则会有许多可选的灯箱解决方案,具有不同的功能和复杂性。只需搜索“视频灯箱”即可。 – pwdst