-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
107 lines (88 loc) · 2.64 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
var menu = document.querySelector('header .nav .nav-bar ul');
var link = document.querySelectorAll('.link');
var btntoggle = document.querySelector('.btn-toggle');
var icon = document.querySelector('.icon');
btntoggle.addEventListener('click', function () {
menu.classList.toggle('show');
})
function linkAction() {
link.forEach(n => n.classList.remove('active'));
this.classList.add('active');
menu.classList.remove('show');
}
link.forEach(n => n.addEventListener('click', linkAction));
var acc = document.getElementsByClassName("skill");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function () {
// this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight == '180px') {
panel.style.maxHeight = 0;
panel.style.padding = '0px';
panel.style.border = 'none';
} else {
panel.style.maxHeight = "180px";
panel.style.padding = '20px';
panel.style.border = '1px solid #8084ff2f';
}
});
}
function showDetail(){
let card = document.querySelector('.work-detail');
card.style.display = 'block';
document.querySelector('.body').style.overflow = 'hidden';
}
function hideDetail(){
let card = document.querySelector('.work-detail');
card.style.display = 'none';
document.querySelector('.body').style.overflow = 'auto';
}
const sr = ScrollReveal({
origin: 'top',
distance: '80px',
duration: 2000,
reset: true
})
sr.reveal('.text');
sr.reveal('.imgPortfolio', { delay: 500 });
// sr.reveal('.about', { delay: 100 });
sr.reveal('.analyse');
sr.reveal('.qualification');
sr.reveal('.dad');
sr.reveal('.works');
sr.reveal('.contact');
let nums = document.querySelectorAll('.item .num');
let section = document.querySelector('.analyse');
let started = false;
window.onscroll = function(){
if(window.scrollY >= section.offsetTop - 230){
if(!started){
nums.forEach((num) => startCount(num));
}
started = true;
}
}
function startCount(el){
let goal = el.dataset.goal;
let count = setInterval(() => {
el.textContent++;
if(el.textContent == goal){
clearInterval(count);
}
},2000/goal);
}
// script img Slide
var indexValue = 1;
showImg(indexValue);
function side_slide(e){showImg(indexValue += e);}
function showImg(e){
var i;
const img = document.querySelectorAll('.img');
if(e > img.length){indexValue = 1}
if(e < 1){indexValue = img.length}
for(i = 0; i < img.length; i++){
img[i].style.display = "none";
}
img[indexValue-1].style.display = "block";
}