我有那个按钮
<li>
<a href="#" data-toggle="modal" data-target="#MyModal">
<span class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
#MyModal
位于控制器中Login
的部分视图ActionResult
内。如何在点击登录时调用该模态?
答案 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>