简体   繁体   English

视频库得到 Uncaught TypeError: $(...).lightGallery is not a function

[英]video gallery getting Uncaught TypeError: $(...).lightGallery is not a function

I am using video.js for my video gallery.我正在为我的视频库使用 video.js。 I tried video.js but I am getting the following error message.我尝试了 video.js,但收到以下错误消息。

Uncaught TypeError: $(...).lightGallery is not a function My code:未捕获的类型错误:$(...).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>

please suggest the solution.请提出解决方案。

您似乎缺少 lightgallery 的脚本标签

<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.2.4/js/lightgallery.min.js"></script>
    $(document).ready(function() {    
        $('#video-gallery').lightGallery({
            videojs: true
        }); 
    });

Strange thing, but the current version could be initialized only this way (typical JQuery syntax doesn't work):奇怪的事情,但当前版本只能以这种方式初始化(​​典型的 JQuery 语法不起作用):

lightGallery($('#video-thumbnails')[0], {
    download: false,
    //other options
});

There is even opened Issue on Github: https://github.com/sachinchoolur/lightgallery.js/issues/42甚至在 Github 上也有打开的问题: https : //github.com/sachinchoolur/lightgallery.js/issues/42

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的TypeError:$(...)。lightGallery不是一个函数 - Uncaught TypeError: $(…).lightGallery is not a function 类型错误:$(...).lightGallery(...).destroy 不是函数 - TypeError: $(...).lightGallery(...).destroy is not a function 使用 lightGallery 和 Jekyll:TypeError: $(...).lightGallery is not a function - using lightGallery and Jekyll: TypeError: $(...).lightGallery is not a function 获取“未捕获的TypeError:$(...)。timeago不是函数” - Getting 'Uncaught TypeError: $(…).timeago is not a function' 获取“未捕获的TypeError:$(...)。dialog不是函数” - Getting “Uncaught TypeError: $(…).dialog is not a function” 未捕获的TypeError:undefined不是函数(关于视频暂停函数) - Uncaught TypeError: undefined is not a function (on video pause function) 未捕获的TypeError:video.removeAttribute不是函数 - Uncaught TypeError: video.removeAttribute is not a function HTML5 视频未捕获类型错误:.play 不是函数 - HTML5 video Uncaught TypeError: .play is not a function 未捕获的错误:确保幻灯片0具有图像/视频src lightgallery - Uncaught Error: Make sure that slide 0 has an image/video src lightgallery 使用 webpack 获取“未捕获的类型错误:$(...).tablesorter is not a function” - Getting 'Uncaught TypeError: $(...).tablesorter is not a function' using webpack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM