Implement Bootstrap-based sub-menus

This commit is contained in:
Maximilian Grundke
2018-04-10 17:00:49 +02:00
parent 8cdf909188
commit ea6d59f3c9
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,17 @@
$(document).ready(function () {
$('ul.dropdown-menu [data-toggle=dropdown]').on('click', function (event) {
event.preventDefault();
event.stopPropagation();
$(this).parent().addClass('open');
var menu = $(this).parent().find("ul");
var menupos = menu.offset();
if ((menupos.left + menu.width()) + 30 > $(window).width()) {
var newpos = -menu.width();
} else {
var newpos = $(this).parent().width();
}
menu.css({left: newpos});
});
});