-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
91 lines (75 loc) · 3.12 KB
/
main.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
//NAVIGATION BAR EFFECTS ON SCROLL
window.addEventListener("scroll",function(){
const header = document.querySelector("header");
header.classList.toggle("sticky", window.scrollY > 0);
});
//DARK THEME TOGGLE
var icon = document.getElementById("icon");
var logo = document.getElementsByClassName("logo")[0];
var image = document.getElementById("image");
icon.onclick = function(){
document.body.classList.toggle("dark-theme");
if(document.body.classList.contains("dark-theme")){
icon.src = "images/sun.png";
logo.src = "images/logo-dark.png";
image.src = "images/portfolio-pic-dark.png";
}else{
icon.src = "images/moon.png";
logo.src = "images/logo-light.png";
image.src = "images/profile-pic.png";
}
}
//PROJECTS SECTION MODAL
const projectModals = document.querySelectorAll(".project-model");
const imgCards = document.querySelectorAll(".img-card");
const projectcloseBtns = document.querySelectorAll(".project-close-btn");
var projectModal = function(modalclick){
projectModals[modalclick].classList.add("active");
}
imgCards.forEach((imgCard, index) => {
imgCard.addEventListener("click", () => {
projectModal(index);
});
});
projectcloseBtns.forEach((closeBtn) => {
closeBtn.addEventListener("click", (event) => {
event.stopPropagation();
projectModals.forEach((projectModalView) => {
projectModalView.classList.remove("active");
});
});
});
//SCROLL REVEAL ANIMATION
//COMMON REVEAL OPTIONS TO CREATE REVEAL ANIMATIONS
ScrollReveal({
reset: true,
distance: '60px',
duration: 2500,
delay: 100
});
ScrollReveal().reveal('.home .info h2, .section-title-01, .section-title-02', {delay: 500, origin: 'left'});
ScrollReveal().reveal('.home .info h3, .home .info p, .about-info .btn', {delay: 600, origin: 'right'});
ScrollReveal().reveal('.home .info .btn', {delay: 700, origin: 'bottom'});
ScrollReveal().reveal('.media-icons i, .contact-left li', {delay: 500, origin: 'left', interval:200});
ScrollReveal().reveal('.home-img, .about-img', {delay: 500, origin: 'bottom'});
ScrollReveal().reveal('.about .description, .contact-right', {delay: 600, origin: 'right'});
ScrollReveal().reveal('.about .professional-list li', {delay: 500, origin: 'right', interval:200});
ScrollReveal().reveal('.skills-description, .contact-card, .contact-left h2', {delay: 700, origin: 'left'});
ScrollReveal().reveal('.education, .projects .img-card', {delay: 800, origin: 'bottom' , interval:200});
ScrollReveal().reveal('.footer-container .group', {delay: 500, origin: 'top'});
//RESPONSIVE NAVIGATION BAR
const menuBtn = document.querySelector(".nav-menu-btn");
const closeBtn = document.querySelector(".nav-close-btn");
const navMenu = document.querySelector(".navigation");
const navItems = document.querySelectorAll(".nav-items a");
menuBtn.addEventListener("click", () => {
navMenu.classList.add("active");
});
closeBtn.addEventListener("click", () => {
navMenu.classList.remove("active");
});
navItems.forEach((navItem) => {
navItem.addEventListener("click", () => {
navMenu.classList.remove("active");
});
});