The dropdown component of the bootstrap has events to handle all interactions.
show.bs.dropdown->This Event Fires immediately when the show instance method is called.
Shown.bs.dropdown->This Event is Fired when the dropdown has been made Visible to the user (will Wait for CSS Transitions, to complete).
Hide.bs.dropdown->This Event is Fired immediately when the Hide instance method has been called.
Hidden.bs.dropdown->This Event is Fired when the dropdown has finished being Hidden from the user (will Wait for CSS Transitions, to complete).
Source.:http://getbootstrap.com/javascript/#dropdowns
You can use this code.:
$('.dropdown.keep-open').on({
"shown.bs.dropdown": function() { this.closable = false; },
"click": function() { this.closable = true; },
"hide.bs.dropdown": function() { return this.closable; }
});
Source.:https://stackoverflow.com/questions/19740121/keep-bootstrap-dropdown-open-when-clicked-off
In the meantime, I checked that if we open a second menu, the first menu is open.
If it’s not the goal you can put this code.:
$('.dropdown').on({
"show.bs.dropdown": function() {
$('.dropdown.open').removeClass('open');
},
"shown.bs.dropdown": function() {
this.closable = false;
},
"click":function() {
this.closable = true;
},
"hide.bs.dropdown": function() {
return this.closable;
}
});
Example.:
http://jsfiddle.net/q6jGr/180/
Hello, for me your question is very vague. can make a jsfiddle that has constriction?
– Tiago Gomes
@I put an example in Codepen.
– marcelo2605
Please mark an answer as correct. (if already solved) so the question is not open.
– Tiago Gomes