Skip to content

Commit

Permalink
Use 'const' instead of 'var'
Browse files Browse the repository at this point in the history
  • Loading branch information
kasugamirai committed Jul 19, 2024
1 parent 48be20b commit 4ba862c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/supplemental-ui/js/landing-page-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
(function () {
'use strict'

var navbarBurger = document.querySelector('.navbar-burger')
const navbarBurger = document.querySelector('.navbar-burger');
if (!navbarBurger) return
navbarBurger.addEventListener('click', toggleNavbarMenu.bind(navbarBurger))

function toggleNavbarMenu (e) {
e.stopPropagation() // trap event
document.classList.toggle('is-clipped--navbar')
navbarBurger.setAttribute('aria-expanded', document.classList.contains('is-clipped--navbar'))
var menu = document.getElementById("topbar-nav")
navbarBurger.setAttribute('aria-expanded', document.classList.contains('is-clipped--navbar').toString())
const menu = document.getElementById("topbar-nav");
if (menu.classList.toggle('is-active')) {
menu.style.maxHeight = ''
var expectedMaxHeight = window.innerHeight - Math.round(menu.getBoundingClientRect().top)
var actualMaxHeight = parseInt(window.getComputedStyle(menu).maxHeight, 10)
const expectedMaxHeight = window.innerHeight - Math.round(menu.getBoundingClientRect().top);
const actualMaxHeight = parseInt(window.getComputedStyle(menu).maxHeight, 10);
if (actualMaxHeight !== expectedMaxHeight) menu.style.maxHeight = expectedMaxHeight + 'px'
}
}
Expand Down

0 comments on commit 4ba862c

Please sign in to comment.