-
Notifications
You must be signed in to change notification settings - Fork 0
/
script1.js
127 lines (114 loc) · 3.38 KB
/
script1.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const about = document.querySelector(".about");
const header = document.querySelector("header");
const about2 = document.querySelector(".about2");
const cursor = document.querySelector(".cursor");
const navItem = document.querySelectorAll(".nav-ul li")
const navLogo = document.querySelector(".nav-logo");
const navBag = document.querySelector(".nav-bag");
const hammburger = document.querySelector(".hamburger");
const navmenu = document.querySelector(".nav-ul");
const navBar = document.querySelector(".navbar");
document.addEventListener('mousemove', (e) => {
cursor.style.left = e.clientX + 'px';
cursor.style.top = e.clientY + 'px';
})
about.addEventListener('mouseenter',(e)=>{
console.log("hii")
cursor.classList.add("circle")
cursor.classList.add("hover1")
})
about.addEventListener('mouseleave',(e)=>{
cursor.classList.remove("circle")
cursor.classList.remove("hover1")
})
about2.addEventListener('mouseenter',(e)=>{
console.log("hii")
cursor.classList.add("circle")
cursor.classList.add("hover1")
})
about2.addEventListener('mouseleave',(e)=>{
cursor.classList.remove("circle")
cursor.classList.remove("hover1")
})
navLogo.addEventListener("mouseenter", (e) => {
cursor.classList.add("hover")
})
navLogo.addEventListener("mouseleave", (e) => {
cursor.classList.remove("hover")
})
navBag.addEventListener("mouseenter", (e) => {
cursor.classList.add("hover")
})
navBag.addEventListener("mouseleave", (e) => {
cursor.classList.remove("hover")
})
navItem.forEach(box => {
box.addEventListener('mouseenter', (e)=>{
cursor.classList.add("hover");
});
});
navItem.forEach(box => {
box.addEventListener('mouseleave', (e)=>{
cursor.classList.remove("hover");
});
});
var prevScrollpos = window.pageYOffset;
window.onscroll = function(){
let currentScroll = window.pageYOffset;
if (prevScrollpos > currentScroll) {
navBar.style.top = "0";
navBar.classList.add("back-filter");
}
if (prevScrollpos < currentScroll){
navBar.style.top = "-80px";
navBar.classList.remove("back-filter");
}
if(currentScroll == 0)
{
navBar.classList.remove("back-filter");
}
prevScrollpos = currentScroll;
}
hammburger.addEventListener("click",(e)=>{
hammburger.classList.toggle("active");
navBar.classList.toggle("black")
header.classList.toggle("black")
navmenu.classList.toggle("active");
document.body.classList.toggle('fixed-position');
})
// Wrap every letter in a span
var textWrapper = document.querySelectorAll('.ml13');
textWrapper.forEach(text=>{
text.innerHTML = text.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
})
anime.timeline({loop: false})
.add({
targets: '.ml13 .letter',
translateY: [100,0],
translateZ: 0,
opacity: [0,1],
easing: "easeOutExpo",
duration: 1400,
delay: (el, i) => 300 + 30 * i
})
gsap.registerPlugin(ScrollTrigger);
gsap.to(".review1",{
x: 130,
duration:3,
start: "",
stop: "top",
scrollTrigger: {
trigger: ".review2",
scrub: true,
toggleActions: "restart none none none",
},
})
gsap.to(".review2",{
x: -130,
duration:3,
scrollTrigger: {
trigger: ".review2",
scrub: true,
toggleActions: "restart none none none",
}
})