-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
40 lines (33 loc) · 1.06 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const hamburger = document.querySelector('.hamburger');
const ul = document.querySelector('ul');
const menuItems = document.querySelectorAll('li');
menuItems &&
menuItems.forEach((item) => {
item.addEventListener('click', () => {
hamburger.classList.remove('active');
ul.style.right = '-100%';
});
});
hamburger &&
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
if (hamburger.classList.contains('active')) {
ul.style.right = '1rem';
} else {
ul.style.right = '-100%';
}
});
const dateContainer = document.querySelector('.date');
const date = new Date();
dateContainer &&
(dateContainer.textContent = date.getFullYear());
const passwordInput = document.getElementById('password');
const showPasswordCheckbox = document.getElementById('show-password');
showPasswordCheckbox &&
showPasswordCheckbox.addEventListener('change', function() {
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
} else {
passwordInput.type = 'password';
}
});