-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_old.js
91 lines (86 loc) · 4.44 KB
/
index_old.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
var scrolllistener = function(event){
if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) {
document.getElementById("userinfodiv").className="shrink";
} else if (document.body.scrollTop <= 1 || document.documentElement.scrollTop <= 1){
document.getElementById("userinfodiv").className="";
}
}
var attachEvents = function(){
document.getElementById('edu').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('education').offsetTop
if(document.getElementById('education').children[0].classList.contains('active')==false){
document.getElementById('education').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('education').children[0].nextElementSibling)
}
}
document.getElementById('cou').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('courses').offsetTop
if(document.getElementById('courses').children[0].classList.contains('active')==false){
document.getElementById('courses').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('courses').children[0].nextElementSibling)
}
}
document.getElementById('ski').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('skills').offsetTop
if(document.getElementById('skills').children[0].classList.contains('active')==false){
document.getElementById('skills').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('skills').children[0].nextElementSibling)
}
}
document.getElementById('exp').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('workexp').offsetTop
if(document.getElementById('workexp').children[0].classList.contains('active')==false){
document.getElementById('workexp').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('workexp').children[0].nextElementSibling)
}
}
document.getElementById('cer').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('certi').offsetTop
if(document.getElementById('certi').children[0].classList.contains('active')==false){
document.getElementById('certi').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('certi').children[0].nextElementSibling)
}
}
document.getElementById('aca').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('projects').offsetTop
if(document.getElementById('projects').children[0].classList.contains('active')==false){
document.getElementById('projects').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('projects').children[0].nextElementSibling)
}
}
document.getElementById('con').onclick = function(){
document.getElementsByTagName('body')[0].scrollTop = 102 + document.getElementById('contact').offsetTop
if(document.getElementById('contact').children[0].classList.contains('active')==false){
document.getElementById('contact').children[0].classList.toggle('active')
setheightforexpandcollapse(document.getElementById('contact').children[0].nextElementSibling)
}
}
}
var setheightforexpandcollapse = function(content){
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
}
var expandcollapse = function(){
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].onclick= function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
}
}
}
window.onload = function(event){
document.getElementsByTagName('body')[0].onscroll = scrolllistener;
expandcollapse()
attachEvents()
setparticles()
}