-
-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1718 from nunocoracao/dev
🔖 v2.77.1
- Loading branch information
Showing
2 changed files
with
13 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
var menuButton = document.getElementById("menu-button"); | ||
var menuCloseButton = document.getElementById("menu-close-button"); | ||
var menuWrapper = document.getElementById("menu-wrapper"); | ||
|
||
var menuOpen = false; | ||
|
||
menuButton.addEventListener("click", function () { | ||
var openMenu = function (e) { | ||
if (!menuOpen) { | ||
menuOpen = true; | ||
var menuWrapper = document.getElementById("menu-wrapper"); | ||
document.body.style.overflowY = "hidden"; | ||
menuButton.style.visibility = "hidden"; | ||
menuWrapper.style.visibility = "visible"; | ||
menuWrapper.style.opacity = "1"; | ||
window.onbeforeunload = function (event) { | ||
closeMenu() | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
menuCloseButton.addEventListener("click", function (e) { | ||
var closeMenu = function (e) { | ||
if (menuOpen) { | ||
menuOpen = false; | ||
var menuWrapper = document.getElementById("menu-wrapper"); | ||
document.body.style.overflowY = "auto"; | ||
menuButton.style.visibility = "visible"; | ||
menuWrapper.style.visibility = "hidden"; | ||
menuWrapper.style.opacity = "0"; | ||
window.onbeforeunload = function (event) { } | ||
e.stopPropagation(); | ||
} | ||
}); | ||
} | ||
|
||
menuButton.addEventListener("click", openMenu); | ||
menuCloseButton.addEventListener("click", closeMenu); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters