Implement Bootstrap-based sub-menus
This commit is contained in:
17
app/assets/javascripts/bootstrap-dropdown-submenu.js
vendored
Normal file
17
app/assets/javascripts/bootstrap-dropdown-submenu.js
vendored
Normal 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});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user