-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhack_script.js
83 lines (71 loc) · 2.37 KB
/
hack_script.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
window.onscroll = function() {stickNavbar()};
const navbar = document.getElementById("navbar");
const sticky = navbar.offsetTop;
function stickNavbar() {
if (window.pageYOffset > sticky) {
navbar.classList.add("sticky");
} else {
navbar.classList.remove("sticky");
}
}
const particleContainer = document.querySelector('.particles');
const starBackground = document.querySelector('.star-background');
for (let i = 0; i < 100; i++) {
const particle = document.createElement('div');
particle.classList.add('particle');
particle.style.top = `${Math.random() * 100}vh`;
particle.style.left = `${Math.random() * 100}vw`;
particle.style.animationDelay = `${Math.random() * 10}s`;
particleContainer.appendChild(particle);
}
for (let i = 0; i < 300; i++) {
const star = document.createElement('div');
star.classList.add('star');
star.style.top = `${Math.random() * 100}vh`;
star.style.left = `${Math.random() * 100}vw`;
starBackground.appendChild(star);
}
var cursor = document.querySelector('.cursor');
var cursorinner = document.querySelector('.cursor2');
var a = document.querySelectorAll('a');
document.addEventListener('mousemove', function(e){
var x = e.clientX;
var y = e.clientY;
cursor.style.transform = `translate3d(calc(${e.clientX}px - 50%), calc(${e.clientY}px - 50%), 0)`
});
document.addEventListener('mousemove', function(e){
var x = e.clientX;
var y = e.clientY;
cursorinner.style.left = x + 'px';
cursorinner.style.top = y + 'px';
});
document.addEventListener('mousedown', function(){
cursor.classList.add('click');
cursorinner.classList.add('cursorinnerhover')
});
document.addEventListener('mouseup', function(){
cursor.classList.remove('click')
cursorinner.classList.remove('cursorinnerhover')
});
a.forEach(item => {
item.addEventListener('mouseover', () => {
cursor.classList.add('hover');
});
item.addEventListener('mouseleave', () => {
cursor.classList.remove('hover');
});
})
// FAQ
document.querySelectorAll('.faq-question').forEach(item => {
item.addEventListener('click', () => {
const answer = item.nextElementSibling;
answer.style.display = answer.style.display === 'block' ? 'none' : 'block';
});
});
// moblies menu
function openNav() {
document.getElementById("mySidenav").style.width = "415px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0px";
}