如何使用 lightbox2 在我的页面中显示视频
首先,我的网站不使用 Drupal。因此,任何弹出视频播放器功能的替代方案都将受到赞赏。
我想在我的网页中显示弹出式 YouTube 视频播放器。我从 以下链接:http://ftp.drupal.org/files/projects/lightbox2-6.x-1.11.zip
我将zip文件提取到我的网站根目录
我在页面标题中添加了以下几行:
<link type="text/css" rel="stylesheet" media="all" href="/lightbox2/css/lightbox.css?1" />
<script type="text/javascript" src="/lightbox2/js/auto_image_handling.js?1"></script>
<script type="text/javascript" src="/lightbox2/js/lightbox_video.js?1"></script>
<script type="text/javascript" src="/lightbox2/js/lightbox.js?1"></script>
并在正文中添加了以下内容:
<a href="http://www.youtube.com/watch?v=0gBtF_awV2o" rel=lightvideo[width:500px;height:400px;]>
<img src="sample" alt="Live TV">
</a>
但是视频在新选项卡中打开,而不是作为弹出窗口打开.我哪里出错了?我在任何地方都找不到这方面的教程,尽管我在许多带有弹出视频的其他页面中都有这种代码。
编辑:使用了shadowbox。打开 YouTube 页面而不是弹出窗口!
编辑: 问题已解决!让 Shadowbox 可以工作。这既精彩又简单。不过商业许可证的费用为 20 美元。
First of all my site does not use Drupal.So any alternatives for a popup video player funcionality would be appreciated.
I want to show a popup you tube video player in my web page.I downloaded lighbox from the
following link: http://ftp.drupal.org/files/projects/lightbox2-6.x-1.11.zip
I extracted the zip file into my sites root
I added the following lines in my page header:
<link type="text/css" rel="stylesheet" media="all" href="/lightbox2/css/lightbox.css?1" />
<script type="text/javascript" src="/lightbox2/js/auto_image_handling.js?1"></script>
<script type="text/javascript" src="/lightbox2/js/lightbox_video.js?1"></script>
<script type="text/javascript" src="/lightbox2/js/lightbox.js?1"></script>
and the following in the body:
<a href="http://www.youtube.com/watch?v=0gBtF_awV2o" rel=lightvideo[width:500px;height:400px;]>
<img src="sample" alt="Live TV">
</a>
But the video opens up in a new tab and not as a popup.Where am i going wrong?I cant find tutorials for this anywhere, although i have this kind of code in many other pages with popup videos.
Edit: Used shadowbox. Opens up youtube page instead of popup!
Edit: Problem solved! Got Shadowbox to work. It's brilliant and easy. The commercial licence costs $20 though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可能没有正确调用 jQuery 或 lightbox。
确保两个
src
正确。我不确定我是否理解您的问题,但您无法使用灯箱显示视频,常见问题解答中是这样说的,并且建议 厚盒。
您还可以使用 videolighbox 或任何其他东西。
祝你好运!
You probably are either not calling jQuery or lighbox correctly.
Make sure the have the two
src
correct.I'm not sure I understood your question but you cant display video with lightbox, it says so in the FAQ and it recommends thickbox.
You could also use something videolighbox or any out there.
Good luck!
我会从这里下载 Lightbox 2 并看看它是否工作得更好。
I would download Lightbox 2 from here and see if it works any better.
它不起作用的原因是 Drupal 模块中包含的 lightbox.js 文件是使用 Drupal.settings 变量的修改版本,如果您不使用 Drupal,则该变量是
未定义
。The reason it doesn't work is because the lightbox.js file included in the Drupal module is a modified version that uses the Drupal.settings variable, which if you don't use Drupal, is
undefined
.Lightbox2 视频可以在 drupal 中运行。
您必须在 lightbox2 设置中启用视频支持
网址:yourdrupal.com/admin/config/user-interface/lightbox2
如果您没有 flv 播放器,则该播放器应该为空。
Lightbox2 video does work in drupal.
You have to enable video support in the lightbox2 settings
The url: yourdrupal.com/admin/config/user-interface/lightbox2
The flv player should be empty if you don't have one.