Bootstrap,Portfolios,&语气

时间:2016-01-07 20:45:52

标签: javascript html bootstrap-modal

我试图让模式出现在投资组合点击中,但它不起作用..但是当我使用常规按钮时,模态会出现。

无效的投资组合按钮:

<a href="#myModal1" class="portfolio-box">
  <img src="img/portfolio/1.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
          <div class="portfolio-box-caption-content">
             <div class="project-name">
                   School
             </div>
          </div>
     </div>
</a>

有效的按钮代码:

 <a data-toggle="modal" href="#myModal1" class="btn btn-primary btn-lg">School Backpack</a>

模态:

<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h4 class="modal-title">School Backpack</h4>
    </div>
    <div class="modal-body">
      ...
    </div>

1 个答案:

答案 0 :(得分:1)

您缺少data-toggle="modal"属性,当您单击按钮时,引导程序需要知道该怎么做。

您的按钮代码应为:

<a data-toggle="modal" href="#myModal1" class="portfolio-box">

希望这有帮助!