(function () {
  var toggle = document.querySelector(".menu-toggle");
  var backdrop = document.querySelector(".sidebar-backdrop");
  function closeNav() {
    document.body.classList.remove("nav-open");
  }
  if (toggle) {
    toggle.addEventListener("click", function () {
      document.body.classList.toggle("nav-open");
    });
  }
  if (backdrop) {
    backdrop.addEventListener("click", closeNav);
  }
  window.addEventListener("resize", function () {
    if (window.innerWidth > 960) {
      closeNav();
    }
  });
})();
