javascript - 创建图像模态

标签 javascript jquery css

我正在尝试在我的应用中创建一个图像模式!我想创建一个模式,例如此链接 - https://codepen.io/koolhaus/pen/ajwcE 这是我的代码:

.portfolio-list a:after {
  color: #ffff;
  content: '\f067';
  font-family: FontAwesome;
  max-width: 100%;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  background: rgba(0, 0, 0, 0.6) center center no-repeat;
  opacity: 0;
  transition: all 0.5s;
  -webkit-transition: all 0.5s;
  text-align: center;
  align-items: center;
  justify-content: center;
}
<div class=" portfolio-container text-center">
  <ul class="portfolio-list" style="margin:0 auto">
    <li style="margin:0 auto">
      <a href="#">
        <img src="{{$img['image']}}">
      </a>
    </li>
  </ul>
</div>

如何在我的代码中添加模态?

最佳答案

对于引导模式:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Small Modal</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <img src="http://minisoft.com.bd/uploads/ourteam/rafiq.jpg" width="100%" height="320px">
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>
</div>

</body>
</html>

关于javascript - 创建图像模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45370976/

相关文章:

javascript - 展开时的 Angular Dropdown 显示在屏幕底部

JavaScript Canvas 在更改宽度后消失

javascript - IFrame 突破

jquery - Typescript + jQuery Promises = .then 类型不匹配

jquery - Append jQuery 将 HTML 添加到具有绝对位置的下一个表格单元格

javascript - 由滚动值触发的 jquery 数字计数器动画

javascript - 将回调传递给深度嵌套函数的最佳实践

asp.net - 防止 jQuery 多重引用

jquery - jqModal 从第一个模式内的链接触发第二个模式窗口

html - 从 iframe 导入 css