如何调用部分中的bootstrap模式?

时间:2016-10-26 11:05:14

标签: jquery asp.net-mvc twitter-bootstrap

我有那个按钮

                    <li>
                <a href="#" data-toggle="modal" data-target="#MyModal">
                    <span class="glyphicon glyphicon-log-in"></span> Login</a>
                </li>

#MyModal位于控制器中Login的部分视图ActionResult内。如何在点击登录时调用该模态?

1 个答案:

答案 0 :(得分:0)

而不是数据属性给你的锚元素一个id:

<header style="position:fixed"class="container-fluid header a">

<div class="row">
 <a href="#top"><img src="http://hguochen.com/static/img/tech/css3.png"style="max-width:80px"class="img-responsive"></a>
<div class="col-xs-6">

  <a href="#scr"><button class="btn btn-primary">ABOUT</button></a>
  <a href="#scr"><button class="btn btn-primary">PORTFOLIO</button></a>
  <a href="#scr"><button class="btn btn-primary">CONTACT</button></a>

</div>
</div>
</div>
</header>

然后绑定到JavaScript中该元素的click事件:

<a href="#" id='myanchor'>
     <span class="glyphicon glyphicon-log-in"></span> Login</a>