创建图像模式

时间:2017-07-28 10:22:32

标签: 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>
&#13;
&#13;
&#13;

如何在代码中添加模态?

2 个答案:

答案 0 :(得分:0)

我的参考 JSFIDDLE

将你的div保持在侧面模态体中。我保留了一次在您当地的主人办理退房手续。别忘了添加对html的引用

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

答案 1 :(得分:0)

对于Bootstrap Modal:

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