mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
26 lines
566 B
JavaScript
26 lines
566 B
JavaScript
var $ = require('jquery');
|
|
|
|
function toggleDropdown(e) {
|
|
var $dropdown = $(e.currentTarget).parent().find('.dropdown-menu');
|
|
|
|
$dropdown.toggleClass('open');
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
}
|
|
|
|
function closeDropdown(e) {
|
|
$('.dropdown-menu').removeClass('open');
|
|
}
|
|
|
|
// Bind all dropdown
|
|
function init() {
|
|
$(document).on('click', '.toggle-dropdown', toggleDropdown);
|
|
$(document).on('click', '.dropdown-menu', function(e){ e.stopPropagation(); });
|
|
$(document).on('click', closeDropdown);
|
|
}
|
|
|
|
module.exports = {
|
|
init: init
|
|
};
|
|
|