![](/img/trans.png)
[英]How to disable toggle function when clicking inside of the element in the bootstrap
[英]How to disable bootstrap collapse when clicking on the particular element inside header?
我有以下代碼來折疊並打開內容。
<h4 class="cartToggleTags collapsed" type="button" data-toggle="collapse" data-target="#cotent1">
<i class="fa fa-edit"></i> Header1
</h4>
<div id="cotent1" class="collapse in">
Content 1
</div>
單擊編輯圖標<i class="fa fa-edit"></i>
時如何禁用折疊或打開功能。
您可以簡單地停止事件傳播,例如
$(document).on('click', '[data-toggle=collapse] .fa', function(e) {
e.stopPropagation();
});
jsFiddle- http://jsfiddle.net/3MEEP/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.