Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion dist/js/scripts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Start Bootstrap - Resume v7.0.6 (https://startbootstrap.com/theme/resume)
* Copyright 2013-2023 Start Bootstrap
* Copyright 2013-2025 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-resume/blob/master/LICENSE)
*/
//
Expand Down Expand Up @@ -31,4 +31,23 @@ window.addEventListener('DOMContentLoaded', event => {
});
});

// Close navbar when clicking outside of it (accessibility improvement)
const navbarCollapse = document.body.querySelector('#navbarResponsive');
if (navbarToggler && navbarCollapse) {
document.addEventListener('click', (event) => {
// Check if navbar is expanded and toggler is visible (mobile view)
const isNavbarExpanded = navbarCollapse.classList.contains('show');
const isTogglerVisible = window.getComputedStyle(navbarToggler).display !== 'none';

if (isNavbarExpanded && isTogglerVisible) {
// Check if click is outside the navbar
const isClickInsideNav = sideNav.contains(event.target);

if (!isClickInsideNav) {
navbarToggler.click();
}
}
});
}

});
19 changes: 19 additions & 0 deletions src/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,23 @@ window.addEventListener('DOMContentLoaded', event => {
});
});

// Close navbar when clicking outside of it (accessibility improvement)
const navbarCollapse = document.body.querySelector('#navbarResponsive');
if (navbarToggler && navbarCollapse) {
document.addEventListener('click', (event) => {
// Check if navbar is expanded and toggler is visible (mobile view)
const isNavbarExpanded = navbarCollapse.classList.contains('show');
const isTogglerVisible = window.getComputedStyle(navbarToggler).display !== 'none';

if (isNavbarExpanded && isTogglerVisible) {
// Check if click is outside the navbar
const isClickInsideNav = sideNav.contains(event.target);

if (!isClickInsideNav) {
navbarToggler.click();
}
}
});
}

});