如何关闭Twitter Bootstrap模态(首次启动后) [英] How to get twitter bootstrap modal to close (after initial launch)
问题描述
我是一个菜鸟,所以我认为我正在使用twitter bootstrap modal监视某些事情(可能很明显).我正在尝试做的是获得一个仅在移动设备上启动的模式.在模态div上添加类.visible-phone,效果很好.到目前为止,一切都很好.但是我希望它能正常工作,这意味着您可以使用X按钮将其关闭.而且我无法使用该按钮.
I'm very much a noob, so I think I'm overseeing something (probably obvious) with twitter bootstrap modal. What I am trying to do is get a modal to launch only on mobile. This works fine with adding the class .visible-phone on the modal div. So far so good. But then I want it to work, meaning you can close it with the X button. And I cannot get the button to work.
<div class="modal visible-phone" id="myModal">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h3>text introductory<br>want to navigate to...</h3>
</div>
<div class="modal-body">
<ul class="nav">
<li> ... list of links here </li>
</ul>
</div>
</div>
在html的底部,我放置了jquery.js(第一个),bootstrap.modal.js和bootstrap.transition.js.实际上,所有的bootstrap js模块(不要错过一个include). 我对js没有经验.
In the bottom of the html I put jquery.js (first) and bootstrap.modal.js and bootstrap.transition.js. Actually all of the bootstrap js modules (not to miss an include). I'm not experienced with js..
如果我提出了一个非常愚蠢的问题,请原谅我.我在日志中找不到针对这种特定情况的答案.
Please forgive me if I posed a really stupid Q. I could not find the answer to this specific situation in the log.
推荐答案
$('#myModal').modal('hide')
应该这样做
这篇关于如何关闭Twitter Bootstrap模态(首次启动后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!