-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
74 lines (64 loc) · 1.89 KB
/
Copy pathscripts.js
File metadata and controls
74 lines (64 loc) · 1.89 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
// rotate text on intro page
var i = 0;
function rotateText() {
const text = document.getElementById('rotating-content');
const textOptions = [
"all things HTML/CSS/Javascript.",
"great books.",
"keeping up to date with web standards.",
"biking and taking care of my plants. 🌿",
"translating PSDs into pixel-perfect websites.",
"practicing yoga and drinking warm coffee. ☕"
];
(i < textOptions.length - 1) ? i++ : i = 0;
text.textContent = textOptions[i];
};
// rotate text every 2.5 seconds
setInterval(rotateText, 2500);
const skills = [
[ "JavaScript", 5 ],
[ "Node.js", 4 ],
[ "MySQL", 4 ],
[ "React", 4 ],
[ "HTML/CSS", 5 ],
[ "Adobe Suite", 4 ],
[ "GIT", 4 ],
[ "Angular", 3 ],
[ "JQuery", 5 ],
[ "UI / Responsive Design", 5 ],
[ "Cross-Browser Compatibility", 4 ],
[ "Google Analytics", 4 ]
]
// populate skills
function populateSkills(arr, el) {
el.innerHTML = arr.map(function(skill) {
let stars = '';
let gray_stars = '';
for(var i=0; i < skill[1]; i++) {
stars += '★';
}
if(skill[1] < 5) {
for(var i=0; i < ( 5 - skill[1]); i++) {
gray_stars += '★';
}
}
return `
<li class="skill">
<span class="skill__name">${skill[0]}</span>
<span class="skill__stars">${stars}</span><span class="gray">${gray_stars}</span>
</li>
`;
}).join('');
}
const [el, el2, el3] = Array.from(document.querySelectorAll('.skills'));
populateSkills(skills.slice(0,4), el);
populateSkills(skills.slice(4,8), el2);
populateSkills(skills.slice(8), el3);
// display additional content
const displayPortfolio = function(e) {
const body = document.querySelector('body')
body.classList.add('expanded');
};
// on clicking 'learn more', expand and display content
const showWork = document.querySelector('#see-my-work');
showWork.addEventListener('click', displayPortfolio, true);