I am using using bootstrap-dropdown to generate a Dropdown menu. I would like to prevent the disappearing of the menu when click on it.
I have implemented the following code, but it does not work. Any idea how to fix it?
<li class="dropdown notification">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="notification-label label label-info">
<i class="icon-inbox icon-white"></i>
<span class="notification-number">{{ unread_notifications }}</span>
</span>
</a>
<ul class="dropdown-menu notification-list"></ul>
</li>
events: {
'click ul.notification-list': 'onClickNotification'
},
onClickNotification: function (e) {
e.preventDefault();
console.log(e);
},
Did you try with event.stopPropagation
?
onClickNotification: function (e) {
e.stopPropagation();
console.log(e)
},
If you want to disable all auto closing of the dropdown you can just disable the listener
$('html').off('click.dropdown')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With