我尝试了一切,并一遍又一遍地检查。但是我仍然找不到我的代码出了什么问题。

我认为img和模式的ID是正确的。头部也没有错...

您能看一下我的代码吗?我真的很感激。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Just a Portfolio</title>
    <link rel="stylesheet" href="css/bootstrap.css">
    <link href='https://fonts.googleapis.com/css?family=Luckiest+Guy' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/style.css">
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <script type="text/javascript" src="js/jquery-2.1.4.min.js">
    </script>

  </head>

  <body>
      <div class="container">

        <div class="row">
          <div class="col-md-6">
            <img src="img/1.png" alt="heiheihei">
          </div>
          <div class="col-md-6 text-right">
            <h1 class="text-uppercase text-thin title-super">Weikang Zhang</h1>
            <h3>It's Now or Never.</h3>
          </div>
        </div>

        <div class="row">
          <div class="col-md-12">
            <img class="title-logo img-responsive" src="img/2.jpg" alt="stussy guy">
          </div>
        </div>

        <div class="row">
          <div class="col-md-12">
            <h2 class="text-muted">Hello</h2>
          </div>
        </div>

        <div class="row">
          <div class="col-md-4">
            <img class="img-responsive" src="img/a.jpg" data-toggle="modal" data-target="#p1">
          </div>
          <div class="col-md-4">
            <img class="img-responsive" src="img/b.jpg">
          </div>
          <div class="col-md-4">
            <img class="img-responsive" src="img/c.jpg">
          </div>
        </div>

        <div class="row">
          <div class="col-md-4">
            <h3 class="text-center">Man</h3>
          </div>
          <div class="col-md-4">
            <h3 class="text-center">Book</h3>
          </div>
          <div class="col-md-4">
            <h3 class="text-center">Woman</h3>
          </div>
        </div>
      </div>

<!-- Modal -->
<div class="modal fade" id="p1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title" id="myModalLabel">Favorite App Page</h4>
      </div>
      <div class="modal-body">
        <img class="img-responsive" src="images/a.jpeg">
        This was my first project in this class. I learned a lot about HTML and CSS.
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

  </body>
</html>

最佳答案

jquery js之前包括bootstrap js。然后尝试。

10-05 20:58