在Bootstrap中使用show.bs.dropdown的过程 [英] Process for using show.bs.dropdown in Bootstrap
本文介绍了在Bootstrap中使用show.bs.dropdown的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
点击下拉列表时使用 show.bs.dropdown
事件的过程是什么?
What is the process for using the show.bs.dropdown
event when a dropdown is clicked?
示例:
当我点击要展开的下拉列表时,它需要运行代码:
When I clicked the dropdown to expand, it needs to run the code:
$('#myDropdown').on('show.bs.dropdown', function () {
// do something…
})
推荐答案
Bootstrap下拉列表 show
event绑定到下拉列表的父元素。例如,请注意 id = myDropdown
..
The Bootstrap dropdown show
event is tied to the parent element of the dropdown. For example, notice the id=myDropdown
..
<div class="btn-group" id="myDropdown">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
Menu
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Choice1</a></li>
<li><a href="#">Choice2</a></li>
<li><a href="#">Choice3</a></li>
<li class="divider"></li>
<li><a href="#">Choice..</a></li>
</ul>
</div>
由此活动处理..
$('#myDropdown').on('show.bs.dropdown', function () {
alert('hello');
})
演示: http://www.bootply.com/114783
这篇关于在Bootstrap中使用show.bs.dropdown的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文