Added animation to context menus
This commit is contained in:
parent
2837c9d57e
commit
dc575faa76
2 changed files with 43 additions and 2 deletions
|
@ -22,16 +22,24 @@ var CiderContextMenu = {
|
|||
var menuBackground = document.createElement("div");
|
||||
var menu = document.createElement("div");
|
||||
menu.classList.add("context-menu-body");
|
||||
menu.classList.add("context-menu-open");
|
||||
menuBackground.classList.add("context-menu");
|
||||
menu.style.left = 0 + "px";
|
||||
menu.style.top = 0 + "px";
|
||||
menu.style.position = "absolute";
|
||||
menu.style.zIndex = "99909";
|
||||
menu.addEventListener("animationend", function () {
|
||||
menu.classList.remove("context-menu-open");
|
||||
}, {once: true});
|
||||
|
||||
// when menubackground is clicked, remove it
|
||||
menuBackground.addEventListener("click", function () {
|
||||
menuBackground.remove();
|
||||
menu.remove();
|
||||
menuBackground.style.pointerEvents = "none";
|
||||
menu.classList.add("context-menu-close");
|
||||
menu.addEventListener("animationend", function () {
|
||||
menuBackground.remove();
|
||||
menu.remove();
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
// add menu to menuBackground
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue