mirror of https://github.com/MISP/MISP
chg: [layout:sidebar] Added a bit of JS to not close the sidebar sub-menu right after the mouse leaves
parent
ce6825ccaa
commit
1a078e2783
|
@ -174,7 +174,7 @@ main.content {
|
|||
top: 50%;
|
||||
}
|
||||
.sidebar .sidebar-link-container:hover .submenu-container {
|
||||
display: block;
|
||||
/* display: block; */
|
||||
}
|
||||
.sidebar .sidebar-link-container .submenu-container:hover {
|
||||
display: block;
|
||||
|
|
|
@ -321,4 +321,17 @@ $(document).ready(() => {
|
|||
$('.sidebar #btn-add-bookmark').click(() => {
|
||||
openSaveBookmarkModal(window.location.pathname)
|
||||
})
|
||||
|
||||
$('.sidebar .sidebar-link-container.parent').on('mouseenter', function() {
|
||||
const $subContainer = $(this).find('.submenu-container')
|
||||
$subContainer.css({ display: 'block' })
|
||||
$(this).on('mouseleave', function() {
|
||||
delay(function () {
|
||||
if (!$subContainer[0].matches(':hover')) {
|
||||
$subContainer.css({ display: 'none' })
|
||||
$(this).trigger('mouseenter')
|
||||
}
|
||||
}, 150)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -147,6 +147,10 @@ function debounce(func, wait, options) {
|
|||
return debounced
|
||||
}
|
||||
|
||||
function delay(func, wait, ...args) {
|
||||
return setTimeout(func, wait, ...args)
|
||||
}
|
||||
|
||||
function arrayEqual(array1, array2) {
|
||||
const array2Sorted = array2.slice().sort();
|
||||
return array1.length === array2.length && array1.slice().sort().every((value, index) => value === array2Sorted[index])
|
||||
|
|
Loading…
Reference in New Issue