Improve sidebar handling when JavaScript is enabled
This commit is contained in:
parent
a3d9be660e
commit
0fd0b16b4c
1 changed files with 16 additions and 1 deletions
|
@ -5,4 +5,19 @@ for (let i = 0; i < forms.length; i++) {
|
|||
form.onsubmit = () => {
|
||||
form.querySelector('input[type="submit"]').disabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const sidebar = document.querySelector('#sidebar')
|
||||
|
||||
document.querySelector('#hamburger').onclick = (e) => {
|
||||
e.preventDefault()
|
||||
sidebar.style.transform = 'translateX(0)'
|
||||
}
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
const style = window.getComputedStyle(sidebar)
|
||||
const matrix = new DOMMatrixReadOnly(style.getPropertyValue("transform"))
|
||||
if (matrix.m41 === 0) {
|
||||
sidebar.style.transform = 'translateX(-100%)'
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue