html - 宏伟的弹出式画廊不弹出

标签 html css magnific-popup

我正在尝试使用 magnific popup 在我的网页上创建一个画廊,但我无法让图像显示在弹出窗口中,它只显示在一个单独的选项卡中。如何让它显示在画廊 View 中并启用循环浏览网页画廊中的所有图像?另外,如何更改正在显示的灯箱的大小和缩略图的大小。

    <!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>

最佳答案

问题出在您的 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

关于html - 宏伟的弹出式画廊不弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34431522/

相关文章:

javascript - HTML 下拉列表显示基于用户输入的数据

html - 尝试将 2 组 2 个 div 每组居中放置在包装器的中间

css - div 出现在 | 之前元素

javascript - 华丽的弹出窗口,选择最后显示的图像

javascript - iOS 上忽略的 jQuery 单击事件

html - css 图像居中的意外元素行为

javascript - Flask:资源被解释为样式表但以 MIME 类型文本/html 传输

javascript - 如何使用 Jquery 检查元素是否具有特定事件

javascript - 网页上多行文本上的省略号 + 引号

magnific-popup - 将回调应用于 Magnific Popup 的所有实例?