-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslidenext.js
27 lines (23 loc) · 1.01 KB
/
slidenext.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
document.addEventListener('DOMContentLoaded', () => {
document.body.classList.add('fade-in');
const polygon = document.querySelector('.polygon');
const nextPageLink = document.getElementById('nextPage');
const mainContent =document.querySelector('.main-content');
if (polygon && nextPageLink && mainContent) {
nextPageLink.addEventListener('click', (e) => {
e.preventDefault();
//hide the main content immediately
mainContent.style.opacity = '0';
mainContent.style.transition = 'opacity 1s easy-out';
// Fade out and slide the polygon to the right
polygon.style.opacity = '0';
polygon.style.transform = 'translateX(100%)';
setTimeout(() => {
document.body.classList.remove('fade-in');
setTimeout(() => {
window.location.href = e.target.href;
}, 250);
}, 500);
});
}
});