Skip to content

Instantly share code, notes, and snippets.

@laurisstepanovs
Last active August 18, 2023 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laurisstepanovs/026f1e74ae345bed35d02880156d702c to your computer and use it in GitHub Desktop.
Save laurisstepanovs/026f1e74ae345bed35d02880156d702c to your computer and use it in GitHub Desktop.
setup() {
// your menu reference
const menuRef = ref<HTMLElement | null>(null);
onMounted(() => {
setTimeout(() => {
if (!menuRef.value) {
return;
}
// get menu instance
const inst = MenuComponent.getInstance(menuRef.value);
// create overlay element
let overlay = document.createElement("div");
overlay.classList.add("drawer-overlay");
overlay.style.zIndex = "104";
overlay.style.display = "none";
document.body.append(overlay);
// show event handler
inst?.on("kt.menu.dropdown.show", function () {
// show overlay
overlay.style.display = "block";
});
// hide event handler
inst?.on("kt.menu.dropdown.hide", function () {
// hide overlay
overlay.style.display = "none";
});
}, 10);
});
return {
menuRef,
};
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment