(26 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
<script> | <script> | ||
− | "use strict";var showMenu=!1,burger=document.getElementById("burger");burger.onclick=function(){showMenu?($("#burger").removeClass("is-active"),$("#navbar").removeClass("is-active"),showMenu=!1):($("#burger").addClass("is-active"),$("#navbar").addClass("is-active"),showMenu=!0)}; | + | "use strict"; |
+ | $("head").append('<meta name="viewport" content="width=device-width, initial-scale=1">'); | ||
+ | var showMenu = !1, burger = document.getElementById("burger"); | ||
+ | function popup(e) { | ||
+ | $("#" + e).css("display", "block"); | ||
+ | location.hash = "#" + e; | ||
+ | $(document).keyup(function(evt) { | ||
+ | if (evt.keyCode === 27) { | ||
+ | hide(e); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | function hide(e) { | ||
+ | $("#" + e).css("display", "none"); | ||
+ | location.hash = ""; | ||
+ | } | ||
+ | burger.onclick = function () { | ||
+ | showMenu | ||
+ | ? ($("#burger").removeClass("is-active"), $("#navbar").removeClass("is-active"), showMenu = !1) | ||
+ | : ($("#burger").addClass("is-active"), $("#navbar").addClass("is-active"), showMenu = !0) | ||
+ | }; | ||
+ | window.onload = function () { | ||
+ | var hash = location.hash.substr(1); | ||
+ | if (hash === "") { | ||
+ | return; | ||
+ | } | ||
+ | popup(hash) | ||
+ | } | ||
</script> | </script> | ||
</html> | </html> |
Latest revision as of 20:23, 13 December 2019