I'm using this script to control open/collapse menu items:
$('.dropdown').on({
"click": function(event) {
if ($(event.target).closest('.dropdown-toggle').length && $(this).parents('.dropdown').length === ($(event.target).parents('.dropdown').length - 1)) {
$(this).data('closable', true);
} else {
$(this).data('closable', false);
}
},
"hide.bs.dropdown": function(event) {
hide = $(this).data('closable');
$(this).data('closable', true);
return hide;
}
});
But I need to create a conditional that if user click outside the menu, the open item not close.
This question involves Bootstrap specificities. Just using:
$(document).on('click', function(event)
Not answer my question completely.