-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscipt.js
24 lines (20 loc) · 964 Bytes
/
scipt.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
// Detect when the section becomes visible on scroll
document.addEventListener('DOMContentLoaded', function() {
const trendingSection = document.querySelector('#trending-books');
function handleScroll() {
const sectionPosition = trendingSection.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.3; // Adjust the value to control when it shows
if (sectionPosition < screenPosition) {
trendingSection.classList.add('visible');
}
}
window.addEventListener('scroll', handleScroll);
});
document.getElementById('menuButton').addEventListener('click', function() {
var dropdown = document.getElementById('menuDropdown');
if (dropdown.style.display === 'none') {
dropdown.style.display = 'block';
} else {
dropdown.style.display = 'none';
}
});