无法让Lightagallery js工作:Uncaught TypeError:无法读取属性' modules'未定义的

时间:2016-02-14 15:11:55

标签: lightgallery

我已经看到一些用户遇到同样的问题:

Lightgallery not working

但我仍然无法让它发挥作用,这是我的代码:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<style type="text/css"></style>
<link rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/lightGallery.css" /> 
<script src="js/jquery-1.12.0.min.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.min.js"></script>
<script src="js/lg-thumbnail.min.js"></script>
<script src="js/lg-fullscreen.min.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $("#lightgallery").lightGallery({
    selector: '.item'});
});
</script>

</head>

<body>
<div class="row">

 <ul class="lightgallery" id="lightgallery">
      <li a class="item" href="images/accessori1.jpg"><img src="images/accessori1.jpg"></a>
      </li>
      <li <a class="item" href="images/accessori1.jpg"><img src="images/accessori1.jpg"></a>
    </ul>
    </div>
</div>
</body>
</html>

无法弄清楚我错过了什么。

感谢您的帮助

2 个答案:

答案 0 :(得分:0)

请您查看此代码,看看它是否有任何帮助?希望它能:)

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<style type="text/css"></style>
<link rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/lightGallery.css" /> 
<script src="js/jquery-1.12.0.min.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.min.js"></script>
<script src="js/lg-thumbnail.min.js"></script>
<script src="js/lg-fullscreen.min.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $("#lightgallery").lightGallery({
    selector: '.item'});
});
</script>

</head>

<body>
<div class="row">

 <ul class="lightgallery" id="lightgallery">
      <li a class="item" href="images/accessori1.jpg"><img src="images/accessori1.jpg"></a></li>
      <li ><a class="item" href="images/accessori1.jpg"><img src="images/accessori1.jpg"></a></li>
    </ul>
</div>
</body>
</html> 

答案 1 :(得分:0)

您尚未连接主文件 - lightgallery.js。 连接它。