-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomepage.js
53 lines (44 loc) · 1.89 KB
/
homepage.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
41
42
43
44
45
46
47
48
49
50
51
52
53
// import { Application } from '@splinetool/runtime';
// const canvas = document.getElementById('canvas3d');
// const app = new Application(canvas);
// app.load('https://prod.spline.design/5foNd0rLoq8ksqHl/scene.splinecode');
// JavaScript to highlight the active link
// JavaScript to add the "active" class to the current page's link
// JavaScript to add the "active" class to the current page's link
var currentPage = window.location.pathname.split('/').pop();
var navLinks = document.querySelectorAll('nav a');
navLinks.forEach(link => {
var linkHref = link.getAttribute('href').split('/').pop();
if (linkHref === currentPage) {
link.classList.add('active');
}
});
window.addEventListener('scroll',reveal);
function reveal(){
let reveals= document.querySelectorAll('.reveal');
for(var i=0;i<reveals.length;i++){
var windowheight=window.innerHeight;
var revealtop=reveals[i].getBoundingClientRect().top;
var revealpoint=150;
if(revealtop<windowheight-revealpoint){
reveals[i].classList.add('active');
}
else{
reveals[i].classList.remove('active');
}
}
}
const introContainer = document.querySelector('.intro');
const animationBox = document.querySelector('.animationbox');
const content = document.querySelector('.content');
window.addEventListener('scroll', () => {
const scrollY = window.scrollY;
const animationOffset = 120;
// Move the animation box to the left based on scroll position
animationBox.style.transform = `translateX(-${scrollY - animationOffset}px)`;
// Adjust the margin of the content to create space for the moving loader
content.style.marginLeft = `${scrollY - animationOffset}px`;
});
// Initial position of the animation box and content
animationBox.style.transform = 'translateX(0)';
content.style.marginLeft = '0';