-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscript.js
63 lines (56 loc) · 1.5 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
const hamburger=document.querySelector(".hamburger");
const navMenu=document.querySelector(".nav-menu");
hamburger.addEventListener("click",()=>{
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
})
var typed = new Typed(".typing-2", {
strings: [" 👨💻 A Tech Enthusiast ","👨🎓 An Electronics, Communication and Information Engineering student ", " 🚀 Aspiring Flutter App Develop","🎨 UI Designer"],
typeSpeed: 100,
backSpeed: 60,
loop: true
});
document.querySelectorAll(".nav-link").forEach(n=>n.addEventListener("click",()=>{
hamburger.classList.remove("active");
navMenu.classList.remove("active");
}))
const myslide = document.querySelectorAll('.myslide'),
dot = document.querySelectorAll('.indicator');
let counter = 1;
slidefun(counter);
let timer = setInterval(autoSlide, 8000);
function autoSlide() {
counter += 1;
slidefun(counter);
}
function plusSlides(n) {
counter += n;
slidefun(counter);
resetTimer();
}
function currentSlide(n) {
counter = n;
slidefun(counter);
resetTimer();
}
function resetTimer() {
clearInterval(timer);
timer = setInterval(autoSlide, 5000);
}
function slidefun(n) {
let i;
for(i = 0;i<myslide.length;i++){
myslide[i].style.display = "none";
}
for(i = 0;i<dot.length;i++) {
dot[i].className = dot[i].className.replace(' active', '');
}
if(n > myslide.length){
counter = 1;
}
if(n < 1){
counter = myslide.length;
}
myslide[counter - 1].style.display = "block";
dot[counter - 1].className += " active";
}