2015-09-28 15 views
2

我正在爲我的視頻庫使用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> 

請建議的解決方案。

+0

將'script'放在'body' cl之前添加標籤即' –

+0

是的,但仍然顯示錯誤.. – Kichu

+0

我沒有看到'lightGallery'包含/已加載的庫 – Tushar

回答

0
$(document).ready(function() {  
     $('#video-gallery').lightGallery({ 
      videojs: true 
     }); 
    }); 
+0

我添加了此代碼,但它仍顯示相同的錯誤 – Kichu

2

你似乎缺少lightgallery

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