-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (29 loc) · 1.03 KB
/
script.js
File metadata and controls
38 lines (29 loc) · 1.03 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
//Skills homepage - alt text appears on hovering logos//
const img = document.querySelectorAll('.skills');
let skillText = document.querySelector('.skilltext');
img.forEach(element => {
element.addEventListener('mouseover', e => {
let alttext = e.target.getAttribute('alt');
skillText.innerHTML = alttext;
});
});
img.forEach (element => {
element.addEventListener("mouseleave", event => {
skillText.innerHTML = ''
});
});
//Portfolio page - collapsible//
var btn = document.querySelectorAll(".collBtn");
btn.forEach(button => {
button.addEventListener("click", function () {
button.classList.toggle("active");
var content = button.previousElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
button.innerHTML = "Read more"
} else {
content.style.display = "block";
button.innerHTML = "Read less";
}
})
});