Skip to content
Merged
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
16 changes: 15 additions & 1 deletion source/_static/js/myscript-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(document).ready(function () {
}

// Listen for changes in the theme preference
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (e) {
// Only update the theme based on prefers-color-scheme if 'data-theme' is 'auto' or not set
if (
!$('body').attr('data-theme') ||
Expand Down Expand Up @@ -149,4 +149,18 @@ $(document).ready(function () {
document.body.classList.toggle('nav-open');
document.getElementById('navigation').classList.toggle('nav-is-active');
});

// Remove classes to close the nav if screen size is larger than 992px
function closeNav() {
if (window.innerWidth > 992) {
document.body.classList.remove('nav-open');
document.getElementById('navigation').classList.remove('nav-is-active');
hamburger.classList.remove('is-active');
}
}

closeNav();

$(window).on('resize', closeNav);

});