巨大的弹出画廊没有弹出

时间:2015-12-23 08:31:48

标签: html css magnific-popup

我正在尝试使用大量弹出窗口在我的网页上创建一个图库,但我无法将图像显示在弹出窗口中,它只会显示在单独的标签中。如何让它显示在图库视图中并启用循环浏览网页库中的所有图像?此外,如何更改正在显示的灯箱大小和缩略图大小。

    <!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="author" content="">
        <meta name="viewport" content="width=device-width; initial-scale=1.0">

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
      <!-- Magnific Popup core CSS file -->
      <link rel="stylesheet" href="magnific-popup/magnific-popup.css">

      <!-- Magnific Popup core JS file -->
      <script src="magnific-popup/jquery.magnific-popup.js"></script>

      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <link rel="stylesheet" href="css/style.css">

  <style type="text/css">

    .modal-dialog {}
.thumbnail {margin-bottom:6px; height: 280px;}

.carousel-control.left,.carousel-control.right{
  background-image:none;
  margin-top:10%;
  width:5%;
}

#open-popup {padding:20px}
.white-popup {
  position: relative;
  background: #FFF;
  padding: 40px;
  width: auto;
  max-width: 200px;
  margin: 20px auto;
  text-align: center;
}

  </style>

  <script type="text/javascript">

    $(document).ready(function() {
  $('.image-link').magnificPopup({type:'image'});

  $('.test-popup-link').magnificPopup({
  type: 'image'
  // other options
});

});




  </script>
    </head>

    <body>
                <div id="main" role="main">
            <br />
                    <br />
        <br />

<div class="parent-container">
  <a href="path-to-image-1.jpg">Open popup 1</a>
  <a href="path-to-image-2.jpg">Open popup 2</a>
  <a href="path-to-image-3.jpg">Open popup 3</a>
</div>


                    </body>
</html>

1 个答案:

答案 0 :(得分:1)

问题出在HTML标记上!!

<a href="path-to-image-1.jpg">Open popup 1</a>这不起作用。

<a class="test-popup-link" href="path-to-image-1.jpg">Open popup 2</a>

但这会奏效。

检查Codepen