gpt4 book ai didi

javascript - 在 Bootstrap 面板上调用事件展开

转载 作者:太空狗 更新时间:2023-10-29 14:39:07 27 4
gpt4 key购买 nike

我正在处理我们使用 Bootstrap 风格 Accordion (不是 jQuery UI Accordion )的流程。需求是在用户展开 Accordion 时调用服务。这是 HTML:

<div class="accordion-dashboard">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading row-white" data-toggle="collapse" data-parent="#accordion" href="#runtimeValue">
<table>
<tr>
<td><span class="badge blue">A</span></td>
<td><strong>Aenean ultricies est lorem,id feugiat velit euismod ut.Nullam inia.Prasent vel nu Sed ante mauris, eu lacus..</strong></td>
<td><i class="icon8 icon-paperclip"></i></td>
<td><span class="time">5 mins</span></td>
</tr>
</table>
</div>
<div id="runtimeValue" class="panel-collapse collapse ">
<div class="panel-body">

<div class="row">
<div class="col-lg-9 col-lg-offset-1">
<table>
<tr>
<td class="text-muted">By</td>
<td><img width="24px" src="images/company-logo.png"> Company Admin</td>
</tr>
<tr>
<td class="text-muted">On</td>
<td class="text-muted">Friday- 7 Aug 2014, 9.00PM</td>
</tr>
<tr>
<td><i class="icon8 icon-paperclip"></i></td>
<td>dummyfile.pdf</td>
</tr>
<tr>
<td colspan="2">
<h5>Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.</h5>
<p>Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.</p>
</td>
</tr>
</table>
</div>
<div class="col-lg-1 pull-right">
<span data-toggle="collapse" data-parent="#accordion" href="#collapseOne" class="btn-close icon8"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

HREF 属性和相应的 id 属性将在运行时决定,我知道它们的模式。一种方法可能是在单击 Accordion 时绑定(bind)事件,但我想将其作为最后的手段。

当用户点击并展开 Accordion 时,有没有其他方法可以调用服务?

最佳答案

你可以使用:-

$('#accordion').on('show.bs.collapse', function () {
//call a service here
});

关于javascript - 在 Bootstrap 面板上调用事件展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26750590/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com