我正在尝试使用 lightgallery.js 创建图像和 HTML5 视频的混合滑块。
图像显示在滑块中,而视频不播放。它给出了这个错误:
糟糕..无法加载内容
下面是我的项目中包含的 CSS 和 JS 文件。
任何人都请建议我是否缺少任何 JS 或 CSS 文件,或者创建幻灯片的方式不正确。
JS部分:
<link href="https://vjs.zencdn.net/7.11.4/video-js.css" rel="stylesheet" />
<script src="https://vjs.zencdn.net/7.11.4/video.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/css/lg-autoplay.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/css/lg-fullscreen.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/css/lg-thumbnail.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/css/lg-video.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/css/lightgallery.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/lightgallery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/plugins/autoplay/lg-autoplay.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/plugins/fullscreen/lg-fullscreen.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/plugins/thumbnail/lg-thumbnail.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.2.0-beta.4/plugins/video/lg-video.min.js" ></script>
<script>
lightGallery(document.getElementById('slideShow'), {
selector: '.item',
});
</script>
HTML部分:
<div id="slideShow">
<div class="item" data-src="../webroot/1.jpg">
<img src="../webroot/1.jpg" />
</div>
<div class="item" data-src="../webroot/2.jpg">
<img src="../webroot/2.jpg" />
</div>
<div class="item" data-src="../webroot/3.jpg">
<img src="../webroot/3.jpg" />
</div>
<div class="item">
<a
data-lg-size="1280-720"
data-video='{
"source": [{"src":"../webroot/1.mp4", "type":"video/mp4"}],
"attributes": {"preload": false, "controls": true}
}'
data-poster="../webroot/1.jpg">
<img
width="300"
height="100"
class="img-responsive"
src="../webroot/1.jpg"
/>
</a>
</div>
</div>