twitter-bootstrap - Twitter Bootstrap灯箱显示YouTube视频

标签 twitter-bootstrap youtube

我正在我的网站上工作,但对HTML还是很陌生。我正在尝试使用Twitter Bootstrap和在这里找到的Twitter Bootstrap Lightbox代码在灯箱中显示YouTube视频:http://jbutz.github.io/bootstrap-lightbox/

我已经能够将图像加载到灯箱中。但是,我不确定要播放YouTube视频需要做什么。当我查看YouTube文档时,它同时提供了iframe和嵌入选项。但是,当我用其中之一替换代码并更改指向我的视频的链接时,灯箱无法加载,当然也看不到视频。

这是我使用embed选项的代码:

<div class="container">
  <div class="row">
    <div class="span12">
      <h4>Band Concert</h4>
        <div id="bandlightbox1" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true">
          <div class="lightbox-content">
            <embed
                width="420" height="345"
                src="https://www.youtube.com/watch?v=og8cxXICoVU"
                type="application/x-shockwave-flash">
            </embed>
              <div class="lightbox-caption">
                <p>This is a video of my friends and I at our band concert. The guy in that glasses is our teacher person. The song is Friday I'm in Love for anyone who doesn't know. I'm on the piano that sounds like a harpsichord.</p>
              </div>
          </div>
        </div>
    </div>
  </div>
</div>

非常感谢您的协助。我仍然很新,很沮丧。

谢谢

最佳答案

    <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="../dist/ekko-lightbox.css" rel="stylesheet">

范例4:YouTube影片库
                <div class="row">
                    <div class="col-md-offset-1 col-md-10">
                        <div class="row">
                            <a href="http://www.youtube.com/watch?v=k6mFF3VmVAs" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
                                <img src="//i1.ytimg.com/vi/yP11r5n5RNg/mqdefault.jpg" class="img-responsive">
                            </a>
                            <a href="http://youtu.be/iQ4D273C7Ac" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
                                <img src="//i1.ytimg.com/vi/iQ4D273C7Ac/mqdefault.jpg" class="img-responsive">
                            </a>
                            <a href="//www.youtube.com/embed/b0jqPvpn3sY" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
                                <img src="//i1.ytimg.com/vi/b0jqPvpn3sY/mqdefault.jpg" class="img-responsive">
                            </a>
                        </div>
                    </div>
                </div>
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
        <script src="../dist/ekko-lightbox.js"></script>

        <script type="text/javascript">
            $(document).ready(function ($) {
                // delegate calls to data-toggle="lightbox"
                $(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
                    event.preventDefault();
                    return $(this).ekkoLightbox({
                        onShown: function() {
                            if (window.console) {
                                return console.log('Checking our the events huh?');
                            }
                        }
                    });
                });
});

首先,您必须添加ekko-lightbox CSS和js文件。
和data-toggle =“lightbox”的jquery代码。




您可以在这里看到:http://ashleydw.github.io/lightbox/#single-image
在href中提供youtube视频的url并设置data-toggle,data-gallery属性

关于twitter-bootstrap - Twitter Bootstrap灯箱显示YouTube视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20181615/

相关文章:

html - 推特 Bootstrap : position list elements by first letter around the center (almost centered)

java - 重定向到youtube以上传可在jsp上使用的视频

iphone - MPMoviePlayerController 播放 YouTube 视频

python - 如何将表单控件添加到 Django 表单?

javascript - 如何在 v-for 循环中使用 BootstrapVue - Modal?

html - 我如何在这个表单旁边保留一个 h1 标签和一个 p 标签? ( Bootstrap )

youtube - 无法获取 RTMP URL 和流 key

java - 从使用 YouTube 数据 API 的个人项目中删除 Google 未经验证的警告

javascript - 如何修复 "If playback doesn' t 很快开始,尝试在 iPad 上使用 Youtube iFrame API 重新启动您的设备?

javascript - 如何在一定距离内停止 twitter bootstrap scrollspy?