forked from abhrajit2004/Twitter-Landing-Page
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.js
30 lines (26 loc) · 1013 Bytes
/
profile.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
// Toggle between light and dark mode
const themeToggleBtn = document.getElementById('themeToggle');
const body = document.body;
themeToggleBtn.addEventListener('click', () => {
body.classList.toggle('dark-mode');
if (body.classList.contains('dark-mode')) {
themeToggleBtn.textContent = '☀️ Light Mode';
} else {
themeToggleBtn.textContent = '🌙 Dark Mode';
}
});
// Profile image upload preview.
function loadProfileImage(event) {
const profileImage = document.getElementById('profileImage');
profileImage.src = URL.createObjectURL(event.target.files[0]);
}
// Profile form submission with feedback.
const profileForm = document.getElementById('profileForm');
const updateSuccessMessage = document.getElementById('updateSuccessMessage');
profileForm.addEventListener('submit', (event) => {
event.preventDefault();
updateSuccessMessage.style.display = 'block';
setTimeout(() => {
updateSuccessMessage.style.display = 'none';
}, 3000);
});