diff --git a/scripts/components/header.js b/scripts/components/header.js index 956abbd4..1fba1daa 100644 --- a/scripts/components/header.js +++ b/scripts/components/header.js @@ -1,5 +1,5 @@ 'use strict' -// This module controls the City of Boston newsletter component +// This module controls the City of Boston header component // --------------------------- var BostonHeader = (function () { var guideTitle; @@ -78,6 +78,15 @@ var BostonHeader = (function () { if (burgerckbx) { burgerckbx.setAttribute("tabIndex", "0"); + burgerckbx.addEventListener("click", function (element) { + if (document.getElementById("cob-content").classList.contains('brg-tr--active')) { + document.getElementById("cob-content").classList.remove('brg-tr--active'); + } + else { + document.getElementById("cob-content").classList.add('brg-tr--active'); + } + }); + } if (searchckbx) { diff --git a/scripts/components/menu.js b/scripts/components/menu.js index d741f829..2f3160e8 100644 --- a/scripts/components/menu.js +++ b/scripts/components/menu.js @@ -1,5 +1,6 @@ 'use strict' - +// This module controls the City of Boston Main RHS Menu +// --------------------------- var BostonMenu = (function () { // Set height var secondaryNavs; @@ -9,21 +10,22 @@ var BostonMenu = (function () { var backTriggers; var burger; var placeholder; - var navMainmenu; - var sticky; + // var navMainmenu; + // var sticky; var navLogo; var navFirstItem; + var siteBanner; // activate class for sticky menu - function mainMenuonScroll() { - sticky = navMainmenu.offsetTop; - - if (window.pageYOffset > sticky) { - navMainmenu.classList.add("sticky"); - } else { - navMainmenu.classList.remove("sticky"); - } - } + // function mainMenuonScroll() { + // sticky = navMainmenu.offsetTop; + // + // if (window.pageYOffset > sticky) { + // navMainmenu.classList.add("sticky"); + // } else { + // navMainmenu.classList.remove("sticky"); + // } + // } function handleTrigger(ev, method) { @@ -69,7 +71,8 @@ var BostonMenu = (function () { // Update the title title.innerHTML = trigger.innerHTML; - } else { + } + else { for (var i = 0; i < listItems.length; i++) { if (parentItem != listItems[i]) { listItems[i].classList.remove('nv-m-c-l-i--h'); @@ -92,13 +95,14 @@ var BostonMenu = (function () { function start() { burger = document.getElementById('brg-tr'); + siteBanner = document.querySelector('.dr-h'); navLogo = document.getElementById('logoImg'); listItems = document.querySelectorAll('.nv-m-c-l-i'); backTriggers = document.querySelectorAll('.nv-m-c-b'); secondaryTriggers = document.querySelectorAll('.nolink'); secondaryNavs = document.querySelectorAll('.nv-m-c-l-l'); secondaryNavItems = document.querySelectorAll('.nv-m-c-a--s'); - navMainmenu = document.getElementById("main-menu"); + // navMainmenu = document.getElementById("main-menu"); navFirstItem = document.querySelector('.nv-m-h-i'); var title = document.getElementById('nv-m-h-t'); @@ -159,12 +163,24 @@ var BostonMenu = (function () { secondaryNavItems[i].classList.add('nv-m-c-a--p'); } - if (navMainmenu) { - window.onscroll = function() { - mainMenuonScroll() - }; + // Note when the site_banner is expanded. + if (siteBanner) { + siteBanner.addEventListener("click", function (element) { + if (document.getElementById("cob-content").classList.contains('site-banner--expanded')) { + document.getElementById("cob-content").classList.remove('site-banner--expanded'); + } + else { + document.getElementById("cob-content").classList.add('site-banner--expanded'); + } + }); } + // if (navMainmenu) { + // window.onscroll = function() { + // mainMenuonScroll() + // }; + // } + } return {