为什么点击我的灯箱图片后无法加载?

时间:2019-03-21 21:27:57

标签: javascript jquery bootstrap-4 lightbox lightbox2

当我单击图像本身时,灯箱会加载,但图像本身不会加载-相反,我看到的只是一个白框。基本上,灯箱会显示,但不会加载图片。我不确定自己在做什么错。我观看了有关如何创建灯箱的youtube视频,并严格按照步骤进行操作。我不知道我在做什么错。我包含了指向正确的javascript和css文件的链接。

请帮助!

这是我下面的html:

<!DOCTYPE html> 
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description:" content="Image Gallery">
  <meta http-equiv="author" content="Fiona Blumin" />
  <title>Image Gallery</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <link href="https://fonts.googleapis.com/css?family=Arvo" rel="stylesheet">
  <link rel="stylesheet" href="style.css" type="text/css">
  <script src="js/jquery.js"></script>
  <link rel="stylesheet" href="lightbox.min.css" type="text/css">
  <script type="text/javascript" src="lightbox-plus-jquery.min.js"></script>
</head>

<body>

  <div class="Welcome">
    <h1>My Travels through Europe</h1>
  </div>

  <div class="Pictures">
    <div class="container-fluid">
      <div class="row">

        <div class="col">
          <a href="images/pic1.jpg" data-lightbox="mygallery">
            <img class="small-img" src="images/pic1 copy.jpg" alt="">
          </a>
        </div>

        <div class="col">
          <a href="images/pic2.jpg" data-lightbox="mygallery">
            <img class="small-img" src="images/pic2 copy.jpg" alt="">
          </a>
        </div>

        <div class="col">
          <a href="images/pic3.jpg" data-lightbox="mygallery">
            <img class="small-img" src="images/pic3 copy.jpg" alt="">
          </a>
        </div>
      </div>

      <div class="row">
        <div class="col">
          <a href="images/pic4.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic4 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic5.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic5 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic6.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic6 copy.jpg" alt="">
          </a>
        </div>
      </div>

      <div class="row">
        <div class="col">
          <a href="images/pic7.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic7 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic8.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic8 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic9.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic9 copy.jpg" alt="">
          </a>
        </div>
      </div>

      <div class="row">
        <div class="col">
          <a href="images/pic10.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic10 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic11.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic11 copy.jpg" alt="">
          </a>
        </div>
        <div class="col">
          <a href="images/pic12.jpg" data-lightbox="mygallery">
          <img class="small-img" src="images/pic12 copy.jpg" alt="">
          </a>
        </div>
      </div>


    </div>
  </div>

</body>

</html>

This how it looks when I click on an image in my gallery:

1 个答案:

答案 0 :(得分:1)

也许这是问题

  

src =“ images / pic1 copy.jpg”

尝试这样做

  

src =“ images / pic1copy.jpg”

,并确保您使用正确的路径定位正确的图片。让我知道它是否有效