-
Notifications
You must be signed in to change notification settings - Fork 0
/
nav.js
30 lines (22 loc) · 1008 Bytes
/
nav.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
// Get elements
const signinBtn = document.getElementById('signin-btn');
const signupBtn = document.getElementById('signup-btn');
const overlay = document.getElementById('overlay');
const searchBar = document.querySelector('.search-bar');
// Function to show overlay and only display search bar
function showOverlay() {
overlay.classList.add('active');
searchBar.style.display = 'flex'; // Show the search bar
}
// Function to hide overlay and search bar
function hideOverlay() {
overlay.classList.remove('active');
searchBar.style.display = 'none'; // Hide the search bar
}
// Event listeners for sign in and sign up buttons
signinBtn.addEventListener('click', showOverlay);
signupBtn.addEventListener('click', showOverlay);
// Close overlay on click outside the search bar
overlay.addEventListener('click', hideOverlay);
// Initially hide the search bar
searchBar.style.display = 'none';