-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
280 lines (181 loc) · 6.49 KB
/
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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
// SKIP-BUTTON
function skip() {
const skipbutton = document.getElementById('alert');
skipbutton.style.display = 'none';
}
// MENU - BUTTON
function onClickMenu() {
document.getElementById("menu").classList.toggle("icon");
document.getElementById("nav").classList.toggle("change");
let elementsToHide = document.querySelectorAll('main');
// Loop through the elements and hide/show them
elementsToHide.forEach(function (element) {
element.classList.toggle('hidden');
});
let elementsToHide1 = document.querySelectorAll('footer');
// Loop through the elements and hide/show them
elementsToHide1.forEach(function (element) {
element.classList.toggle('hidden');
});
let elementsToHide2 = document.querySelectorAll('#cell-container');
// Loop through the elements and hide/show them
elementsToHide2.forEach(function (element) {
element.classList.toggle('hide');
});
let elementsToHide4 = document.querySelectorAll('.language a');
// Loop through the elements and hide/show them
elementsToHide4.forEach(function (element) {
element.classList.toggle('hidden');
});
let elementsToHide3 = document.querySelectorAll('.medium-item li');
// Loop through the elements and hide/show them
elementsToHide3.forEach(function (element) {
element.classList.toggle('hidden');
});
let elementsToHide5 = document.querySelectorAll('.navbar');
// Loop through the elements and hide/show them
elementsToHide5.forEach(function (element) {
element.classList.toggle('hide1');
});
let elementsToHide6 = document.querySelectorAll('.language pre');
// Loop through the elements and hide/show them
elementsToHide6.forEach(function (element) {
element.classList.toggle('hidden');
});
let elementsToHide7 = document.querySelectorAll('.search-button');
// Loop through the elements and hide/show them
elementsToHide7.forEach(function (element) {
element.classList.toggle('hide2');
});
let elementsToHide8 = document.querySelectorAll('html');
// Loop through the elements and hide/show them
elementsToHide8.forEach(function (element) {
element.classList.toggle('hide3');
});
let elementsToHide9 = document.querySelectorAll('body');
// Loop through the elements and hide/show them
elementsToHide9.forEach(function (element) {
element.classList.toggle('hide3');
});
}
// IMAGE-SLIDER
let flag = 0;
function controller(x) {
flag = flag + x;
slideshow(flag);
}
slideshow(flag);
function slideshow(num) {
let slides = document.getElementsByClassName('slide');
if (num == slides.length) {
flag = 0;
num = 0;
}
if (num < 0) {
flag = slides.length - 1;
num = slides.length - 1;
}
for (let y of slides) {
y.style.display = "none";
}
slides[num].style.display = "block";
}
// VIDEO-CONTAINER-1
const videoContainer1 = document.querySelector(".main-container1");
const video1 = document.querySelector(".video-container1 video");
videoContainer1.addEventListener("mouseenter", () => {
video1.play();
});
videoContainer1.addEventListener("mouseleave", () => {
video1.pause();
video1.load(); // This resets the video to the beginning everytime it is hovered
});
// VIDEO-CONTAINER-2
const videoContainer2 = document.querySelector(".main-container2");
const video2 = document.querySelector(".video-container2 video");
videoContainer2.addEventListener("mouseenter", () => {
video2.play();
});
videoContainer2.addEventListener("mouseleave", () => {
video2.pause();
video2.load();
});
// VIDEO-CONTAINER-3
const videoContainer3 = document.querySelector(".video-container3");
const video3 = document.querySelector(".video-container3 video");
const poster3 = document.getElementById("poster3");
videoContainer3.addEventListener("mouseenter", () => {
poster3.style.opacity = 0;
video3.play();
});
videoContainer3.addEventListener("mouseleave", () => {
poster3.style.opacity = 1;
video3.pause();
video3.currentTime = 0; // This resets the video to the beginning everytime it is hovered
});
// VIDEO-CONTAINER-4
const videoContainer4 = document.querySelector(".video-container4");
const video4 = document.querySelector(".video-container4 video");
videoContainer4.addEventListener("mouseenter", () => {
video4.play();
});
videoContainer4.addEventListener("mouseleave", () => {
video4.pause();
video4.load();
});
// VIDEO-CONTAINER-5
const videoContainer5 = document.querySelector(".video-container5");
const video5 = document.querySelector(".video-container5 video");
const poster5 = document.getElementById("poster5");
videoContainer5.addEventListener("mouseenter", () => {
poster5.style.opacity = 0;
video5.play();
});
videoContainer5.addEventListener("mouseleave", () => {
poster5.style.opacity = 1;
video5.pause();
video5.currentTime = 0;
});
//MAKES VIDEO-6 MOVES ALONG WITH CURSOR
document.addEventListener('mousemove', (event) => {
const Container = document.querySelector('#hovervideo video');
const xOffset = -40;
const yOffset = -40;
const mouseX = event.clientX + xOffset;
const mouseY = event.clientY + yOffset;
Container.style.left = `${mouseX}px`;
Container.style.top = `${mouseY}px`;
});
// CIRCULAR-TEXT-EFFEXT
const text = document.querySelector('.text p');
text.innerHTML = text.innerText.split("").map(
(char, i) =>
`<span style="transform:rotate(${i * 13.2}deg)">${char}</span>`
).join("");
const text1 = document.querySelector('.text5 p');
text1.innerHTML = text1.innerText.split("").map(
(char,i) =>
`<span style="transform:rotate(${i * 12.3}deg)">${char}</span>`
).join("") ;
const text2 = document.querySelector('.text6 p');
text2.innerHTML = text2.innerText.split("").map(
(char,i) =>
`<span style="transform:rotate(${i * 13.2}deg)">${char}</span>`
).join("") ;
// PRE-LOADER
const preloader1 = document.getElementById('preloader');
function myFunction() {
preloader.style.display = 'none';
}
// SCROLL ANIMATION
let section = document.querySelectorAll('.section');
window.onscroll = () => {
section.forEach(sec => {
let top = window.scrollY;
let offset = sec.offsetTop;
let height = sec.offsetHeight;
if(top >= offset - 3.8*height){
sec.classList.add('show-animate');
}
})
}