-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
146 lines (119 loc) · 4.21 KB
/
Copy pathscript.js
File metadata and controls
146 lines (119 loc) · 4.21 KB
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
const typed = new Typed('.multiple-text',
{
strings : ['Frontend developer','Content Creator','Microsoft learn Student ambassador'],
typeSpeed : 50,
backSpeed :50,
backDelay : 1000,
loop : true
});
const header = document.querySelector('header');
const bars=document.querySelector('.bars');
const xmark=document.querySelector('.cross')
const menuicon= document.querySelector('.menu');
menuicon.addEventListener('click',function(){
bars.classList.toggle('activemenu');
xmark.classList.toggle('activemenu');
header.style.display=header.style.display=='flex'?'none':'flex';
})
const cards = [
document.querySelector('.card1'),
document.querySelector('.card2'),
document.querySelector('.card3'),
document.querySelector('.card4'),
document.querySelector('.card5'),
document.querySelector('.card6'),
];
const ExperiencesSlider = document.querySelector('.ExperiencesSlider_card');
let slideCounter = 1;
const repeat =function(cards,sign){
cards.forEach(card=>{
card.style.transform =`translate(${sign}${slideCounter*100}%)` ;
})
}
setInterval(function() {
repeat(cards,sign='-');
if(slideCounter==4){
slideCounter=0;
repeat(cards,sign='+');
}
else{
slideCounter++;
};
},2500);
const map = L.map('map').setView([27.6710, 84.4304], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([27.6710, 84.4304]).addTo(map)
.bindPopup('Bharatpur, Chitwan, Nepal')
.openPopup();
// Scroll into view
const Home = document.querySelector('.Home');
const Achievement = document.querySelector('.Achievement');
const Skills = document.querySelector('.skills');
const projects_experiences = document.querySelector('.projects_experiences');
const contact = document.querySelector('.contact');
const Experiences = document.querySelector('.Experiences_projects');
const Home_section = document.querySelector('main');
const Achievements_section = document.querySelector('.Achievements_section');
const skills_section =document.querySelector('.Skills')
const Contact_section= document.querySelector('.contact_me')
const raw = [Home, Achievement, Skills, projects_experiences, contact];
const goto = document.querySelector('.goto_top');
const body = document.querySelector('body');
function scrollToTall(data) {
data.scrollIntoView({ behavior: 'smooth' });
}
goto.addEventListener('click', function() {
scrollToTall(body);
});
Home.addEventListener('click', function() {
scrollToTall(Home_section);
});
Achievement.addEventListener('click', function() {
scrollToTall(Achievements_section);
});
Skills.addEventListener('click', function() {
scrollToTall(skills_section);
});
projects_experiences.addEventListener('click', function() {
scrollToTall(Experiences);
});
contact.addEventListener('click', function() {
scrollToTall(Contact_section);
});
const AllSection = [Home_section,Achievements_section,skills_section,Experiences,Contact_section]
const revealSection=function(entries,observer){
const [entry] = entries;
if(!entry.isIntersecting) return;
if (entry.target.classList.contains('hidden')) {
entry.target.classList.remove('hidden');
}
else{
entry.target.classList.remove('hiddenn');
}
}
const SectionObserver= new IntersectionObserver(revealSection,{
root:null,
threshold:0.1,
})
AllSection.forEach(function(section){
SectionObserver.observe(section);
});
//Navbar active
const navOptions = document.querySelectorAll(".navoption");
navOptions.forEach(option => {
option.addEventListener("click", () => {
navOptions.forEach(opt => opt.classList.remove("navactive"));
option.classList.add("navactive");
});
});
function MouseFollowers() {
let follower = document.querySelector('.cursor');
window.addEventListener('mousemove', (e) => {
const scrollX = window.scrollX;
const scrollY = window.scrollY;
follower.style.transform = `translate(${e.clientX + scrollX}px, ${e.clientY + scrollY}px)`;
});
}
MouseFollowers();