如何使用数据解除来解除引导面板? [英] How can I dismiss a bootstrap panel using data-dismiss?

查看:116
本文介绍了如何使用数据解除来解除引导面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打开面板的按钮,我希望能像关闭警报一样关闭它。

I have a button which opens a panel and I want to be able to close it like I would with an alert.

bootstrap docs的默认面板示例

The Default panel example from bootstrap docs

<div class="panel panel-default">
  <div class="panel-heading">Panel heading without title</div>
  <div class="panel-body">
    Panel content
  </div>
</div>

如果我为面板标题添加了一个关闭按钮,按钮会删除标题只要。

If I add a close button as documented for an alert to the panels header, the button removes the header only.

推荐答案

您可以使用非文档功能设置解雇操作的目标...

You can do this by using an undocument feature to set the target of the dismiss action...

<button type="button" class="close" 
data-target="#id_of_panel" 
data-dismiss="alert">
<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
</button>

这将使关闭按钮关闭面板而不是其父元素。

This will make the close button close the panel as opposed to its parent element.

这篇关于如何使用数据解除来解除引导面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆