overleaf-cep/services/web/frontend/js/features/navbar/index.ts
Davinder Singh 698d2aebb1 adding a check on the variable (#27021)
GitOrigin-RevId: 9ecc517ff9bee1dac14e579d494294c0efeb6b69
2025-07-10 08:08:29 +00:00

9 lines
357 B
TypeScript

const toggleButton = document.getElementById('navbar-toggle-btn') as HTMLElement
toggleButton?.addEventListener('click', () => {
// Delay allows Bootstrap to update aria-expanded first
setTimeout(() => {
const isExpanded = toggleButton.getAttribute('aria-expanded') === 'true'
document.body.classList.toggle('no-scroll', isExpanded)
}, 5)
})