twitter-bootstrap 在 Bootstrap 3 中关闭面板
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32249250/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dismiss panel in Bootstrap 3
提问by DasSaffe
I have the following code:
我有以下代码:
<div class="col-md-6">
<div class="panel panel-primary copyright-wrap" id="copyright-wrap">
<div class="panel-heading">
Copyright Info
<button type="button" class="close"
data-target="copyright-wrap"
data-dismiss="panel">
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
</div>
<div class="panel-body">
© some random dude
</div>
</div>
</div>
But for some reason it just doesn't work. Is a paneleven dismissable? I found solutions for alerts and modals, but not for panels. Another person stated, that there is an undocumented feature ( How can I dismiss a bootstrap panel using data-dismiss?)
但由于某种原因,它不起作用。是panel即使dismissable?我找到了警报和模态的解决方案,但没有找到面板的解决方案。另一个人说,有一个未记录的功能(如何使用 data-dismiss 关闭引导面板?)
But that didn't work either.
但这也不起作用。
Have a look at this JSFiddle
看看这个JSFiddle
回答by Zath
As per Relequestual's code, it seems you were missing the hashtag in the targetparameter, and the dismissparameter was suppose to stay set to alert.
根据Relequestual 的代码,您似乎缺少target参数中的主题标签,并且该dismiss参数应该保持设置为alert.
example: http://jsfiddle.net/y9yroaee/
回答by Meysam Ebrahimi
Please use this sample Code:
请使用此示例代码:
<div class="panel panel-default fade in collapse" id="demo" >
<div class="panel-heading"> <a data-toggle="collapse" href="#demo" class="close" >× </a>
</div><div class="panel-body"></div></div>

