-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
816 lines (707 loc) · 24.2 KB
/
index.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
/* **********************************************PRELOADER******************************************** */
const preLoader = document.querySelector(".preLoader");
const wheelAndHamster = document.querySelector(".wheel-and-hamster");
window.addEventListener("load", function () {
setTimeout(function () {
wheelAndHamster.style.transform = "translate(-60vw)";
wheelAndHamster.style.transitionDuration="1.5s";
}, 2000);
setTimeout(() => {
preLoader.style.opacity = "0";
preLoader.style.transition = " 0.5s";
}, 3000);
setTimeout(() => {
preLoader.style.display = "none";
}, 3500);
});
// ****************************SWITCH TO PC************************************
// Function to show the switchToPc div after a 15-second delay
// if (window.matchMedia("(max-width: 800px)").matches) {
// function showSwitchToPcDiv() {
// var switchToPcDiv = document.getElementsByClassName("switchToPc")[0];
// switchToPcDiv.style.display = "flex";
// }
// // Wait for the site to load, then set the delay to show the switchToPc div
// window.addEventListener("load", function () {
// setTimeout(showSwitchToPcDiv, 15000); // 15000 milliseconds = 15 seconds
// });
// }
// // Function to hide the switchToPc div when the button is clicked
// var switchToPcBtn = document.querySelector(".switchToPcBtn");
// switchToPcBtn.addEventListener("click", () => {
// setTimeout(() => {
// switchToPcBtn.parentElement.style.display = "none";
// }, 500);
// });
// **************************Perpetual Animation Starts Here**********************
function PerpetualAnimation() {
function moveBox(
boxName,
initialLeftValue,
initialTopValue,
finalLeftValue,
finalTopValue,
imgName,
time,
delayValue,
moveX,
moveY
) {
const boxMovementKeyframes = [
{ top: initialTopValue, left: initialLeftValue },
{ top: finalTopValue, left: finalLeftValue },
];
var wordpressBox = document.querySelectorAll(boxName);
wordpressBox.forEach((element, index) => {
var boxMovementTiming = {
duration: time,
iterations: Infinity,
easing: "linear",
delay: index * delayValue, // Adjusted delay value
};
element.style.opacity = "0.8";
element.animate(boxMovementKeyframes, boxMovementTiming);
element.style.backgroundImage = `url("images/${imgName}")`;
});
}
// function moveBox(boxName,initialLeftValue,initialTopValue,finalLeftValue,finalTopValue,imgName,time,delayValue,moveX,moveY)
// moveBox(".htmlBox",'-2.5%','-2.5%','102.5vw','102.5vh',"6.png",8500,600);
// moveBox(".cssBox",'12.5%','-50px','100vw','87.5vh',"2.png",10000,700);
moveBox(".jsBox", "25%", "-50px", "100vw", "75vh", "js.png", 10000, 715);
moveBox(
".cssBox",
"37.5%",
"-50px",
"100vw",
"62.5vh",
"css.png",
11000,
1000
);
moveBox(".htmlBox", "50%", "-50px", "100vw", "50vh", "html.png", 7000, 1000);
moveBox(
".wordpressBox",
"62.5%",
"-50px",
"100vw",
"37.5vh",
"wordpress.png",
10500,
2100
);
moveBox(
".reactjsBox",
"75%",
"-50px",
"100vw",
"25vh",
"reactJS.png",
4000,
1000
);
if (window.innerWidth > 800) {
moveBox(
".chashmaBox",
"87.5%",
"-50px",
"100vw",
"12.5vh",
"figma.png",
3000,
1000
);
}
}
PerpetualAnimation();
// ***********************************Navbar********************************
// function navbar(){
// function navMenuAnimation(navMenuID, videoSrc){
// // const navMenus = document.querySelector('.navbarMenusDiv');
// const video = document.querySelector(navMenuID);
// video.src = videoSrc;
// video.autoplay = true;
// video.muted = true;
// video.addEventListener("click", () => {
// video.play();
// });
// }
// navMenuAnimation('#navHome', 'vidAnimations/navHome.mp4');
// navMenuAnimation('#navMiniProjects', 'vidAnimations/navMiniProjects.mp4');
// navMenuAnimation('#navRandomThoughts', 'vidAnimations/navRandomThoughts.mp4');
// }
// navbar();
// **************************************MOBILE MENUS ***********************************
const mobileMenus = document.querySelectorAll(".mobileMenus");
function mobileMenuReset() {
mobileMenus.forEach((element) => {
element.style.height = "42px";
element.style.width = "42px";
element.style.transform = "translateY(0%)";
});
}
function activeMobileMenu(element) {
element.style.height = "62px";
element.style.width = "62px";
element.style.transform = "translateY(-30%)";
}
function menuRedirection(menuID, url) {
const menuItem = document.getElementById(menuID);
menuItem.addEventListener("click", function () {
setTimeout(() => {
window.location.href = url;
}, 1000);
});
}
menuRedirection("home","/");
menuRedirection("miniProjects","https://madhavendra.me/mini-projects/");
menuRedirection("randomThoughts","https://madhavendra.me/mini-projects/");
mobileMenus.forEach((element) => {
element.addEventListener("click", function () {
mobileMenuReset();
activeMobileMenu(element);
});
});
// ***********************************EXPLODING DP********************************
function explodingImage() {
const mainImage = document.getElementById("main-image");
const imageWidth = mainImage.offsetWidth;
const imageHeight = mainImage.offsetHeight;
const numCols = 15; // Number of columns in the grid
const numRows = 15; // Number of rows in the grid
const colWidth = Math.floor(imageWidth / numCols);
const rowHeight = Math.floor(imageHeight / numRows);
const adjustedWidth = colWidth / numCols;
const adjustedHeight = rowHeight / numRows;
for (let row = 0; row < numRows; row++) {
for (let col = 0; col < numCols; col++) {
const imgShards = document.createElement("div");
imgShards.className = "draggable-image";
imgShards.style.width = colWidth + "px";
imgShards.style.height = rowHeight + "px";
imgShards.style.left = col * colWidth + "px";
imgShards.style.top = row * rowHeight + "px";
imgShards.style.backgroundImage = `url(profile.png)`;
imgShards.style.backgroundPosition = `-${col * colWidth}px -${
row * rowHeight
}px`;
imgShards.style.backgroundSize = `${imageWidth}px ${imageHeight}px`;
mainImage.appendChild(imgShards);
imgShards.addEventListener("mouseover", explodeElement);
// draggableElement.addEventListener('mouseout', unexplodeElement);
}
}
mainImage.style.width = adjustedWidth + "px";
mainImage.style.height = adjustedHeight + "px";
}
if (window.matchMedia("(min-width: 1100px)").matches) {
explodingImage();
}
function explodeElement() {
this.style.transition = "transform 0.5s ease-in-out";
this.style.transform = `translate3d(${getRandomNumber()}px, ${getRandomNumber()}px, ${getRandomNumber()}px) rotateX(${getRandomNumber()}deg) rotateY(${getRandomNumber()}deg) rotateZ(${getRandomNumber()}deg)`;
setTimeout(() => {
unexplodeElement.call(this); // Reset the transform after the delay
}, 500);
}
function unexplodeElement() {
this.style.transition = "transform 0.3s linear";
this.style.transform =
"translate3d(0, 0, 0) rotateX(0) rotateY(0) rotateZ(0)";
}
function getRandomNumber() {
return Math.random() * 800;
}
// ************************************zeroGravity starts here**************************************
function zeroGravity(zeroGravityElement) {
gravityElements = document.querySelectorAll(zeroGravityElement);
gravityElements.forEach((element) => {
function getRandomNumber(min, max) {
return Math.random() * (max - min + 1) + min;
}
translateXNum = getRandomNumber(0, 60);
translateYNum = getRandomNumber(70, 120);
rotateNum = getRandomNumber(100, 250);
var zeroGravityKeyFrames = [
{ transform: "translateY(0) translateX(0) rotate(0deg)" },
{
transform: `translateY(-${translateYNum / 2}vh) translateX(-${
translateXNum / 2
}vh) rotate(${rotateNum}deg`,
},
{
transform: `translateY(-${translateYNum}vh) translateX(-${translateXNum}vh)`,
},
];
var zeroGravityTiming = {
duration: 5000,
iterations: 1,
fill: "forwards",
easing: "ease-in",
};
element.animate(zeroGravityKeyFrames, zeroGravityTiming);
});
}
// *****************************zeroGravity ends here**************************************
function calculateDistanceFromBottom(element) {
var rect = element.getBoundingClientRect();
var windowHeight = window.innerHeight;
var distanceFromBottom = windowHeight - rect.bottom;
return distanceFromBottom;
}
function freezeAnimations(className) {
className.forEach((element) => {
var animations = element.getAnimations();
animations.forEach((animation) => {
animation.pause();
});
});
}
// **********************HIGH GRAVITY DROP STARTS*******************************
function gravityDrop(gravityDropElement) {
var gravityElements = document.querySelectorAll(gravityDropElement);
freezeAnimations(gravityElements);
gravityElements.forEach((element) => {
var highGravityKeyframes = [
{ transform: `translateY(150vh) rotate(-50deg)` },
];
var highGravityTiming = {
duration: 2000,
iterations: 1,
fill: "forwards",
easing: "ease-in",
};
element.animate(highGravityKeyframes, highGravityTiming);
});
}
// **********************HIGH GRAVITY DROP ENDS*******************************
// ************************* normal gravity starts here*******************************
function normalGravity(normalGravityElement, dur) {
var gravityElements = document.querySelectorAll(normalGravityElement);
// freezeAnimations(gravityElements);
gravityElements.forEach((element) => {
var highGravityKeyframes = [
{ transform: "translateY(0) translateX(0) rotate(0deg)" },
];
var highGravityTiming = {
duration: dur,
iterations: 1,
fill: "forwards",
easing: "ease-in",
};
element.animate(highGravityKeyframes, highGravityTiming);
});
}
// ************************* normal gravity ends here*******************************
// ******************************gravityControlFunction starts here*******************************
var gravityBtnState = "normal";
var heartbeatBtnState = "normal";
function gravityControlFunction(buttonElement, gravityAnimationElements) {
var gravityControlButton = document.querySelector(buttonElement);
gravityControlButton.addEventListener("click", function () {
if (gravityBtnState === "normal") {
zeroGravity(gravityAnimationElements);
gravityBtnState = "zeroGravity";
gravityControlButton.style.boxShadow = "0 4px 6px yellow";
} else {
normalGravity(gravityAnimationElements, 1500);
gravityBtnState = "normal";
gravityControlButton.style.boxShadow = "0 0px 0px yellow";
}
});
}
gravityControlFunction(".gravityControlButton", ".animationElements");
// ****************************HEARTBEAT BUTTON STARTS HERE*******************************
const heartbeatKeyframes = [
{ transform: "scale(1)", offset: 0 },
{ transform: "scale(0.91)", offset: 0.1 },
{ transform: "scale(0.98)", offset: 0.17 },
{ transform: "scale(0.87)", offset: 0.33 },
{ transform: "scale(1)", offset: 0.45 },
];
const heartBeatDuration = {
duration: 800,
easing: "ease-in-out",
iterations: Infinity,
};
const heartBeatButton = document.querySelector(".heartBeatButton");
const animationElements = document.querySelectorAll(".animationElements");
heartBeatButton.addEventListener("click", function () {
if (heartbeatBtnState === "normal") {
heartBeatButton.style.boxShadow = "0 5px 5px red";
normalGravity(".animationElements", 500);
animationElements.forEach((element) => {
element.animate(heartbeatKeyframes, heartBeatDuration);
});
heartbeatBtnState = "beating";
} else {
heartBeatButton.style.boxShadow = "0 0px 0px red";
animationElements.forEach((element) => {
element.getAnimations().forEach((animation) => {
animation.pause();
});
});
normalGravity(".animationElements", 500);
heartbeatBtnState = "normal";
}
});
// **************************************vibrate BUTTON STARTS HERE**************************************
let vibrateButtonState = "normal";
const vibrateKeyframes = [
{
transform: "translate(0)",
offset: 0,
},
{
transform: "translate(-6px, -6px)",
offset: 0.1,
},
{
transform: "translate(6px, -6px)",
offset: 0.2,
},
{
transform: "translate(-6px, 6px)",
offset: 0.3,
},
{
transform: "translate(6px, 6px)",
offset: 0.4,
},
{
transform: "translate(-6px, -6px)",
offset: 0.5,
},
{
transform: "translate(6px, -6px)",
offset: 0.6,
},
{
transform: "translate(-6px, 6px)",
offset: 0.7,
},
{
transform: "translate(-6px, -6px)",
offset: 0.8,
},
{
transform: "translate(6px, -6px)",
offset: 0.9,
},
{
transform: "translate(0)",
offset: 1,
},
];
const vibrateDuration = {
duration: 400, // Replace this with the actual duration in milliseconds
easing: "linear",
iterations: Infinity,
};
const vibrateButton = document.querySelector(".vibrateButton");
vibrateButton.addEventListener("click", function () {
if (vibrateButtonState === "normal") {
vibrateButton.style.boxShadow = "0 5px 5px green";
normalGravity(".animationElements", 500);
animationElements.forEach((element, index) => {
const randomTime = Math.floor(Math.random() * 100); // Generate a random number between 0 and 50
setTimeout(() => {
element.animate(vibrateKeyframes, vibrateDuration);
}, index * 50);
});
vibrateButtonState = "bouncing";
} else {
vibrateButton.style.boxShadow = "0 0px 0px green";
animationElements.forEach((element) => {
element.getAnimations().forEach((animation) => {
animation.pause();
});
});
normalGravity(".animationElements", 500);
vibrateButtonState = "normal";
}
});
// **********************************section 3 starts here****************************
// proficiency level starts here
function proficiencyLevel(proficiencyElementId, value, colorValue) {
proficiencyElement = document.getElementById(proficiencyElementId);
targetElement = proficiencyElement.lastElementChild.lastElementChild;
// targetElement.style.backgroundImage ="linear-gradient(90deg, #FA0000 0%, #FAB400 100.07%)";
proficiencyElement.lastElementChild.lastElementChild.style.backgroundColor =
"#FAB400";
targetElement.style.height = "100%";
targetElement.style.width = 0 + "%";
targetElement.style.animationDuration = "2s";
widthAnimationKeyframes = [{ width: "0%" }, { width: value + "%" }];
widthAnimationTiming = {
duration: (value / 100) * 2000,
iterations: 1,
fill: "forwards",
easing: "ease-in",
};
targetElement.animate(widthAnimationKeyframes, widthAnimationTiming);
}
// proficiencyLevel(proficiencyElement,value,colorValue)
const section3 = document.getElementById("section3");
// let animationExecuted = false;
// section3.addEventListener("mouseenter", section3AnimationHandler);
// function section3AnimationHandler() {
// if (!animationExecuted) {
// animationExecuted = true;
// section3Animation();
// }
// }
const specialityBigDiv1 = document.getElementById("specialityBigDiv1");
const specialityBigDiv2 = document.getElementById("specialityBigDiv2");
const specialityBigDiv3 = document.getElementById("specialityBigDiv3");
const specialityBigDiv4 = document.getElementById("specialityBigDiv4");
const specialityBigDiv5 = document.getElementById("specialityBigDiv5");
// Animation function
function specialityBigDiv1animation() {
proficiencyLevel("html", 90);
proficiencyLevel("react", 15);
proficiencyLevel("wordpress", 80);
proficiencyLevel("mongodb", 70);
proficiencyLevel("flask", 60);
}
function specialityBigDiv2animation() {
proficiencyLevel("figma", 80);
proficiencyLevel("canva", 90);
proficiencyLevel("coreldraw", 45);
proficiencyLevel("illustrator", 20);
proficiencyLevel("photoshop", 15);
}
function specialityBigDiv3animation() {
proficiencyLevel("research", 90);
proficiencyLevel("analysis", 85);
proficiencyLevel("word", 80);
proficiencyLevel("powerPoint", 80);
proficiencyLevel("excel", 60);
}
function specialityBigDiv4animation() {
proficiencyLevel("dataCleaning", 85);
proficiencyLevel("statisticalAnalysis", 70);
proficiencyLevel("dataVisualisation", 85);
proficiencyLevel("python", 65);
proficiencyLevel("knime", 50);
}
function specialityBigDiv5animation() {
proficiencyLevel("daVinci", 70);
proficiencyLevel("audacity", 45);
proficiencyLevel("adobeAnimate", 55);
proficiencyLevel("adobeAfterEffects", 45);
proficiencyLevel("logoAnimation", 80);
}
const intersectionObserver1 = new IntersectionObserver(
(entries) => {
if (entries[0].intersectionRatio >= 0.1) {
specialityBigDiv1animation();
}
},
{
threshold: 0.1,
}
);
intersectionObserver1.observe(specialityBigDiv1);
const intersectionObserver2 = new IntersectionObserver(
(entries) => {
if (entries[0].intersectionRatio >= 0.1) {
specialityBigDiv2animation();
}
},
{
threshold: 0.1,
}
);
intersectionObserver2.observe(specialityBigDiv2);
const intersectionObserver3 = new IntersectionObserver(
(entries) => {
if (entries[0].intersectionRatio >= 0.1) {
specialityBigDiv3animation();
}
},
{
threshold: 0.1,
}
);
intersectionObserver3.observe(specialityBigDiv3);
const intersectionObserver4 = new IntersectionObserver(
(entries) => {
if (entries[0].intersectionRatio >= 0.1) {
specialityBigDiv4animation();
}
},
{
threshold: 0.1,
}
);
intersectionObserver4.observe(specialityBigDiv4);
const intersectionObserver5 = new IntersectionObserver(
(entries) => {
if (entries[0].intersectionRatio >= 0.1) {
specialityBigDiv5animation();
}
},
{
threshold: 0.1,
}
);
intersectionObserver5.observe(specialityBigDiv5);
// *****************************section 4 STARTS HERE************************************
// SLIDER BUTTONS*********************************
fitContentWalaDiv = document.getElementById("fitContentWalaDiv");
section4sliderWindow = document.getElementById("section4sliderWindow");
document
.getElementById("rightArrowSection4")
.addEventListener("click", function () {
var section4 = document.getElementById("section4");
section4sliderWindow.scrollBy(window.innerWidth, 0); // Scroll 100vw (viewport width) to the right
});
document
.getElementById("leftArrowSection4")
.addEventListener("click", function () {
section4sliderWindow.scrollBy(-window.innerWidth, 0); // Scroll 100vw (viewport width) to the left
});
// index boxes *********************************
const indexNumberBoxes = document.querySelectorAll(".indexNumberBox");
let scrollPosition = 1;
function scrollByViewportWidth(value) {
section4sliderWindow.scrollBy(value * window.innerWidth, 0);
}
function handleIndexClick(index) {
return function () {
const scrollDirection = index - scrollPosition;
scrollByViewportWidth(scrollDirection);
scrollPosition = index;
};
}
indexNumberBoxes.forEach((box, index) => {
box.addEventListener('click', handleIndexClick(index + 1));
});
// scrollposition = 1;
// indexNumberBox1.addEventListener("click", function () {
// section4sliderWindow.scrollBy(-window.innerWidth*2, 0); // Scroll 200vw (viewport width) to the left
// scrollposition = 1;
// });
// indexNumberBox3.addEventListener("click", function () {
// section4sliderWindow.scrollBy(window.innerWidth*2, 0); // Scroll 200vw (viewport width) to the right
// scrollposition=3;
// });
// indexNumberBox2.addEventListener("click",function(){
// if(scrollposition===1)
// {
// section4sliderWindow.scrollBy(window.innerWidth, 0);
// scrollposition=1;
// }
// else if(scrollposition===3)
// {
// section4sliderWindow.scrollBy(-window.innerWidth, 0);
// scrollposition=3;
// }
// });
// project PREVIEW WINDOW
const previewButtons = document.querySelectorAll(".loadWebsitePreviewButton");
previewButtons.forEach(function (button) {
button.addEventListener("click", function () {
const websitePreviewDiv = button.closest(".websitePreviewDiv");
const websitePreviewImg =
websitePreviewDiv.querySelector(".websitePreviewImg");
const iframe = websitePreviewDiv.querySelector("iframe");
projectTitle = websitePreviewDiv.querySelector(".projectTitle");
var websiteName = projectTitle.innerHTML;
websitePreviewImg.style.display = "none";
iframe.style.display = "block";
iframe.src = "https://" + websiteName;
});
});
// previewButton.addEventListener("click", function () {
// previewImg.style.display = "none";
// websitePreview.style.display = "block";
// websitePreview.src = "https://aquaregiafest.com";
// });
var projectTitle = document.querySelectorAll(".projectTitle");
projectTitle.forEach((element) => {
var websiteName = element.innerHTML;
console.log(websiteName);
var url = "https://" + websiteName;
element.addEventListener("click", function (event) {
event.preventDefault(); // Prevents the default click behavior
window.open(url, "_blank"); // Opens the link in a new tab
});
});
// ******************FLIP CARD ANIMATION***********************
// var flipCard = document.querySelector('.flipCard');
var websiteInfoButton = document.querySelectorAll(".websiteInfoButton");
closeWebsitePreviewDescriptionButton = document.querySelectorAll(
".closeWebsitePreviewDescriptionButton"
);
websiteInfoButton.forEach(function (element) {
element.addEventListener("click", function () {
const flipCard = element.closest(".flipCard");
flipCard.style.transform = "rotateY(180deg)";
});
});
closeWebsitePreviewDescriptionButton.forEach(function (element) {
element.addEventListener("click", function () {
const flipCard = element.closest(".flipCard");
flipCard.style.transform = "rotateY(0deg)";
});
});
// autiowidth for stats************************************
var projectStatsSubDivColor = document.querySelectorAll(
".projectStatsSubDivColor"
);
projectStatsSubDivColor.forEach(function (element) {
var projectStatsSubDivColorWidth = element.nextElementSibling.innerHTML;
element.style.width = projectStatsSubDivColorWidth;
});
// PROJECT STATS BUTTON*******************************************
ProjectStatsButton = document.querySelectorAll(".ProjectStatsButton");
ProjectStatsButton.forEach(function (element) {
element.addEventListener("click", function () {
console.log("clicked");
const projectStatsDiv = element.nextElementSibling;
if (projectStatsDiv) {
projectStatsDiv.classList.toggle("projectStatsDivActive");
} else {
console.error("No ancestor element with class 'projectStatsDiv' found.");
}
});
});
ProjectStatsButton = document.querySelectorAll(".ProjectStatsButton");
ProjectStatsButton.forEach(function (element) {
element.addEventListener("click", function () {
console.log("clicked");
const projectStatsDiv = element.closest(".projectStatsDiv");
projectStatsDiv.classList.toggle("projectStatsDivActive");
});
});
// **********************************FOOTER STARTS HERE**************************************
// footer ADD LINK AND LOGO
function addLink(logoID, link) {
button = document.getElementById(logoID).parentElement;
button.addEventListener("click", () => {
setTimeout(() => {
window.open(link);
}, 1000);
});
}
addLink("linkedinLogo","https://www.linkedin.com/in/madhvendra-naruka-52b52621a/");
addLink("githubLogo", "https://github.com/Madhavendra-Naruka");
addLink("mailLogo", "mailto:madhvendrasinghnaruka@gmail.com");
addLink("whatsappLogo", "https://wa.me/9829620291");
addLink("callLogo", "tel:9829620291");
window.addEventListener("scroll", function () {
var scrollContainer = document.querySelector(".customScrollContainer");
var scrollSnapCont = document.querySelector(".scrollSnapCont");
if (
window.innerHeight + window.pageYOffset >=
document.scrollSnapCont.offsetHeight - 400
) {
scrollContainer.style.transform = "translateX(-250px)";
scrollContainer.style.transitionDuration = ".2s";
console.log("yoompopopopopoopopop");
} else {
scrollContainer.style.transform = "translateX(0px)";
scrollContainer.style.transitionDuration = ".2s";
}
});