javascript - 视频库出现 Uncaught TypeError : $(. ..).lightGallery 不是函数

标签 javascript jquery video.js

我正在使用 video.js 作为我的视频库。我尝试了 video.js,但收到以下错误消息。

未捕获类型错误:$(...).lightGallery 不是函数 我的代码:

<html>
<head>
    <link href="http://vjs.zencdn.net/4.12/video-js.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://vjs.zencdn.net/4.12/video.js"></script>
</head>

<body>
    <!-- Hidden video div -->
    <div style="display:none;" id="video1">
        <video class="lg-video-object lg-html5 video-js vjs-default-skin" controls preload="none">
            <source src="videos/test1.mp4" type="video/mp4">
             Your browser does not support HTML5 video.
        </video>
    </div>
    <div style="display:none;" id="video2">
        <video class="lg-video-object lg-html5 video-js vjs-default-skin" controls preload="none">
            <source src="videos/test2.mp4" type="video/mp4">
             Your browser does not support HTML5 video.
        </video>
    </div>

    <!-- data-src should not be provided when you use html5 videos -->
    <ul id="video-gallery">
      <li data-poster="video-poster1.jpg" data-sub-html="video caption1" data-html="#video1" >
          <img src="1.jpg" />
      </li>
      <li data-poster="video-poster2.jpg" data-sub-html="video caption2" data-html="#video2" >
          <img src="2.jpg" />
      </li>
      ...
    </ul>


</body>
<script>
    $('#video-gallery').lightGallery({
        videojs: true
    }); 

</script>

</html>

请提出解决方案。

最佳答案

您似乎缺少 lightgallery 的脚本标记

<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.2.4/js/lightgallery.min.js"></script>

关于javascript - 视频库出现 Uncaught TypeError : $(. ..).lightGallery 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32821603/

相关文章:

php - jQuery 投票系统

jquery $.ajax() 函数图像缓存问题

javascript - Videojs HLS m3u8 文件无法在 iOS 设备和 Safari 浏览器中播放

javascript - 宽度属性不适用于 VideoJS 播放按钮

javascript - 如何继续循环直到我的变量等于用户输入? JavaScript

javascript - 如何将负十进制转换为十六进制?

javascript - 如何使用 Promise 链接两个 Ajax 请求

javascript - 如何修复函数原型(prototype)上的 'is not a function' 错误?

javascript - 平板电脑的工具提示或弹出窗口?

javascript - Video.js this.tech 未定义 firefox